Signup Now
Results 1 to 4 of 4
  1. #1
    Free User
    Join Date
    May 2017
    Posts
    22
    Reputation
    10
    Rep Power
    0

    If char stuck in pzone, what alternative for islocation() special check can be used in persistent?

    Hey everyone,

    Char get stuck sometimes in dp/offline statues. Issue is that the char gets kicked out by 15min inactivity and relogs with reconnector, sometimes doing so for 5-6hours while I'm asleep.
    I have one possible solution written down and just wondered how to improve code.
    This is a noob solution so far, just to pause bot if it happens.
    Code:
    local timeStuck = 5 --in minutes
    auto(120000)
    if($standtime >= timeStuck * 60 * 1000)then
    	printmessage("char hasn't moved 5 mins")
    	logout()
    	pausebot(true)
    end
    I want to resume bot with a special check but problem is there's 2 pzone, the offline train and depot
    How is it possible to do something like islocation() check within persistent if it is either depot or offline train area like code below?
    islocation() won't work as it is persistent not action script with x,y,z, pos. What code could be used to check if surrounding area is offlineTrain/depot?
    Code:
    local timeStuck = 5 --in minutes
    auto(120000)
    if(($pzone) and ($standtime >= timeStuck * 60 * 1000))then
    
    	--check location if depot
    	if(islocation(5))then     
    		gotolabel('Start','Depot')
    
    	--check location if not depot then it's offlineTrain
    	else
    	      gotolabel('Start','FromOfflineTrain')
            end
           
    end
    Last edited by GimmePancakes; 06-16-2017 at 09:43 AM.

  2. #2
    Free User kirro's Avatar
    Join Date
    Jul 2015
    Posts
    336
    Reputation
    121
    Rep Power
    19
    You could solve it by creating 2 Special Areas, one around Depot and another around offline Trainers, with policy None and avoidance 0 and then use
    isinsidespecialarea()

    to check where you are.

    For example (I didn't try it out):
    local StuckTime = 5 --in minutes
    local SpecialAreas = {'Depot', 'FromOfflineTrain'} --Special Areas, give them same Name as the waypointsection you want to skip back in when stuck there
    local BackLabel = 'Start' --Name of the Label you are going to skip back in (same for all sections)
    local PrintLocation = true --print Information about where you got stuck if not in area

    auto(1000)
    if $pzone and $standtime > (StuckTime * 60 * 1000) then
    for i, v in ipairs(SpecialAreas) do
    if isinsidespecialarea(v) then
    if PrintLocation then
    printerror('Character was stuck in '..v..', skipped to '..BackLabel..'/'..v..'')
    end
    gotolabel(BackLabel, v)
    end
    end
    end
    Last edited by kirro; 06-16-2017 at 11:11 AM.





    Troubled Animals Quest [100+]
    ALL
    Feyrist Animals Surface [160+]
    RP
    Feyrist Silencers Underground X1 [180+]
    RP | EK
    Feyrist Silencers Underground X2 [200+]
    RP | EK
    Feyrist Silencers Surface [210+]
    RP | EK
    Rathleton Sewers [240+]
    RP
    Glooth Fairy [350+]
    ED/MS
    Hardcore Draken Walls [400+]
    EK

  3. #3
    Free User
    Join Date
    May 2017
    Posts
    22
    Reputation
    10
    Rep Power
    0
    Quote Originally Posted by kirro View Post
    You could solve it by creating 2 Special Areas, one around Depot and another around offline Trainers, with policy None and avoidance 0 and then use
    isinsidespecialarea()

    to check where you are.

    For example:
    local StuckTime = 5
    local DepotArea = 'sareadepot' --Special area around depot
    local OfflineTrains = 'sareatrainers' --Special area around trainers

    auto(1000)
    if $pzone and $standtime > (StuckTime * 60 * 1000) then
    if isinsidespecialarea(DepotArea) then
    gotolabel('Start', 'Depot')
    printerror('Character was stuck in Depot, skipped to Start/Depot')
    elseif isinsidespecialarea(OfflineTrains) then
    gotolabel('Start', 'FromOfflineTrain')
    printerror('Character was stuck in Trainers, skipped to Start/FromOfflineTrain')
    end
    elseif $Standtime > (StuckTime * 60 * 1000) then
    if $pzone then
    printerror('Character is stuck in unknown Protection Zone at {'..$posx..', '..$posy..', '..$posz..'}, in ('..$wptid..', '..$wptsection..'), closing client')
    closeclient()
    else
    printerror('Character is stuck at {'..$posx..', '..$posy..', '..$posz..'}, in ('..$wptid..', '..$wptsection..'), closing client')
    closeclient()
    end
    end
    This is great stuff to learn about :'D Thank you kirro!

  4. #4
    Free User kirro's Avatar
    Join Date
    Jul 2015
    Posts
    336
    Reputation
    121
    Rep Power
    19
    Quote Originally Posted by GimmePancakes View Post
    This is great stuff to learn about :'D Thank you kirro!
    I think my first code was more than you asked for, i updated my post with a lighter Version but u Need to try if it works





    Troubled Animals Quest [100+]
    ALL
    Feyrist Animals Surface [160+]
    RP
    Feyrist Silencers Underground X1 [180+]
    RP | EK
    Feyrist Silencers Underground X2 [200+]
    RP | EK
    Feyrist Silencers Surface [210+]
    RP | EK
    Rathleton Sewers [240+]
    RP
    Glooth Fairy [350+]
    ED/MS
    Hardcore Draken Walls [400+]
    EK

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •