Some pointers also:
Try using the TYPE for the gate (exploitable by third part, i know. but that can be avoided) as opposed to the ID of the gate. you can remedy this easily with a check.
if findtype 0xf6c '0x0' 'ground' 1 5
endif
You can also make use of distance variable in order to avoid third party exploitation (aka someone dropping a gate and your script selecting it instead). The distance check can be implemented with information based off of the original findtype check.
http://www.runuo.com/products/assistuo/doc/statements/distance-and-rangeExample :
if distance 'found' == 0
Sometimes when you only take one step out of moongate hidden, you aren't given a stealth check and thus wont receive a gain for it so utilizing a for loop in a direction away then to the gate can be beneficial.
Example:
turn "South"
for 4
walk "South"
endfor
pause '750'
for 4
walk "North"
endfor
Unfortunately with the limitation of AUO you cannot set a non-mobile target as an anchor to move around so various distance checks are required and logical thought given to movement.
Also something very useful when dealing with gumps is the waitforgump function.
http://www.runuo.com/products/assistuo/doc/gumps/wait-for-gumpExample :
waitforgump 0x258 5000
Again given the limitations of AUO, the ideal method for handling the destination selection would be via control of a Integer that is incremented +1 every turn (and reset after 8, allowing for travel through all tram destinations except New Haven) HOWEVER with the assistance of x and y checks on 'self' you can maintain a semblance of control over avoiding selecting a destination that is located where you are currently.
Please see
http://www.runuo.com/products/assistuo/doc/statements/loops-and-keywords for x and y check :
// Check character position
if x 'self' >= 380 and y 'self' <= 45
// Tell party
partymsg 'Inside treasure zone!'
endif
Example :
if x 'self' == 1828 and y 'self' == 2949
replygump 0x258 1 5
endif
if x 'self' == 2701 and y 'self' == 693
replygump 0x258 1 6
endif
I know you didn't ask for it, but I hope that this helps :>