|
ultimase Newbie
Joined: 21 Aug 2011 Posts: 2
|
Posted: Sun Aug 21, 2011 6:13 pm
the dreaded #WA command |
Be easy on me I haven't programmed in a good 10+ years...
So I'm developing a alias for a thief that will stealth the thief, walk into a room, backstab a mob, then walk out of room. After this the alias waits for a total of 13 seconds before repeating the process again. Entry into the alias is:
zxc direction in, mob name, direction out
What I've come up with is this:
#var mobdead 0
#while (@mobdead !=1) {
#IF (@hp<525) {#SA low hp} {
#IF (@sp>500) {
so
%1
sigil %2
backstab %2
%3
so
#SA all conditions met, fire backstab
#WA 7000
}
}
#WA 7000
}
mobdead is set to 1 once the mob dies in another trig.
Which appears to work pretty well, but this alias hangs every so often on the waits. After reading through the website I've realized the waits are what is making everything inconsistent. However, I've tried to write in alarms or conditional waits but always end up getting endless loops. Can anyone give me an example of a re-write that would make this alias more consistent?
Thanks in advance. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4701 Location: Pensacola, FL, USA
|
Posted: Mon Aug 22, 2011 9:06 pm |
not sure what
Code: |
so
%1
sigil %2
backstab %2
%3
so |
is, but i assume the 'sos' are you make sure all three variables exist, that being the case you would want
Code: |
#IF (%1 AND %2 AND %3) {
%1
sigil %2
backstab %2
%3
} |
Make sure to name your alarms so you dont get too many of them, that is usually where the loops fall in.
If you name the alarms there is only ever one active no matter how many times the creation alias is fired.
your alarm would look something like..
#ALARM "BackstabAgain" +7 {zxc %1 %2 %3}
That may need to be wrapped in an #EXEC or have the 3 variables use a real variable to work right.
Your #WHILE would also just become an #IF. Speaking of the while, i see nothing that would increment the value of @mobDead, which may also account for your loops.
#WAIT is really buggy in zMUD, however it does work as intended in CMUD. CMUD also offers local variables which together can really clean up code. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
ultimase Newbie
Joined: 21 Aug 2011 Posts: 2
|
Posted: Tue Aug 23, 2011 2:06 am |
Actually the way the alias is written is:
zxc %1 %2 %3
so zxc north monster_name exit direction
SO is my alias for stealth on/off
mobdead is a true/false tag that is set to 1 when another trigger is set off but the monster dying.
So would this be close to the equivalent of what I have above with an alarm instead of a wait...
#var mobdead 0
#IF (@hp<525) {#SA low hp} {
#IF (@sp>500) {
so
%1
sigil %2
backstab %2
%3
so
#SA all conditions met, fire backstab
#ALARM "BackstabAgain" +13 {zxc %1 %2 %3}
}
#until (mobdead =1) |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4701 Location: Pensacola, FL, USA
|
Posted: Tue Aug 23, 2011 2:44 am |
you know that as a simple boolean, 0 is false and any other value is true, thats what my #IF (%1 AND %2) was, checking for a non 0/null value
your second #SAY is announcing that your backstab can be fired... after sending all the cmmands to do it?
Also, your until loop isnt doing anything.
you need a trigger to set your mobdead to true when you successfully make the kill, else it will just keep trying to backstab indefinately
should probably stick an #IF check on @mobDead in the #ALARM as well, else the alias will force an infinate loop my resetting to 0 every time. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|