Moving to a different area after a certain amount of time

Posted by Xandler on Fri 25 Jun 2021 01:47 PM — 2 posts, 11,863 views.

#0
I basically want to use the clearer variable (and trigger set-up) to move from a certain zone after a set amount of time (it respawns too fast for me to kill it all and affects my levels per hour by a lot)

The clearer trigger set-up I have is as follows:

<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   group="solo"
   keep_evaluating="y"
   match="That mob does not exist, cannot be sensed, or there is no path to them."
   name="lycan"
   send_to="12"
   sequence="100"
  >
  <send>clearer = tonumber (GetVariable ("clearer")) or 0
clearer = clearer + 1
SetVariable ("clearer", clearer)
if @clearer == 1 then
SetVariable ("target", "lycan")
Send 'sense lycan'
else
if @clearer == 2 then
SetVariable ("target", "fiera")
Send 'sense fiera'
else
if @clearer == 3 then
SetVariable ("target", "cyclopian")
Send 'sense cyclopian'
else
if @clearer == 4 then
SetVariable ("target", "secluded")
Send 'sense secluded'
else
if @clearer == 5 then
SetVariable ("target", "camouflaged")
Send 'sense camouflaged'
else
SetVariable ("clearer", "1")
SetVariable ("target", "lycan")
Send 'sense lycan'
end
end
end
end
end</send>
  </trigger>
</triggers>


I want it to move on from the "cyclopian" area after say, 30 minutes. I've tried throwing in a
 
if GetVariable ("clearer") == 3 
then DoAfterSpecial (30, "sense self", sendto.world)
end

after that particular section, but I just can't get this to fire (I know DoAfterSpecial uses seconds (used 30 for testing)). Do I need to use an entirely different trigger to set this up?
USA Global Moderator #1
First, There's no good reason to use the @ client variable expansion "@clearer" like that. Just look at the local numeric variable for clearer that you've already created there.

Second, all of those "end"s are weird. Lua has "elseif" https://www.lua.org/pil/4.3.1.html.

Third, GetVariable returns a string, not a number. Just like you shouldn't use @clearer there, you also shouldn't use GetVariable("clearer") there when you've already read it into a numeric local variable.

Try

clearer = tonumber (GetVariable ("clearer")) or 0
clearer = clearer + 1
SetVariable("clearer", clearer)

if clearer == 1 then
   SetVariable ("target", "lycan")
   Send 'sense lycan'
elseif clearer == 2 then
   SetVariable ("target", "fiera")
   Send 'sense fiera'
elseif clearer == 3 then
   SetVariable ("target", "cyclopian")
   Send 'sense cyclopian'
   DoAfterSpecial (30, "sense self", sendto.world)
elseif clearer == 4 then
   SetVariable ("target", "secluded")
   Send 'sense secluded'
elseif clearer == 5 then
   SetVariable ("target", "camouflaged")
   Send 'sense camouflaged'
else
   SetVariable ("clearer", 1)
   SetVariable ("target", "lycan")
   Send 'sense lycan'
end