|
robthesilent Newbie
Joined: 05 Oct 2002 Posts: 7 Location: Australia
|
Posted: Tue Sep 16, 2003 6:31 am
Please advise and suggest |
How would I make a script/trigger/macro/whatever that will ;
run into a room, cast a spell, run out
with conditions (and this is the bit I find that falls down) like stop if hit points are low, spell points low, and when they die, bury their corpses, and then move to the next part of the quest
I know that is very vague, what I currently have is @hp @maxhp @sp @maxsp @dir @enemy, and am currently setting it off with trigger 'go'
#TRIGGER {go} {#PR "choose enemy";#PR "Which way";@dir;brainstorm;%reversedir@dir;hp}
thats the essence of it, but this is ugly
would making something else that assigned @enemy and @dir, then then called them from "go" be better? what would that look like.
And the if isnt working, and I dont see why
#IF {@HP<@MAXHP/2} {#STOP}
#IF {@SP<@MAXSP/2} {#STOP}
then it needs to wait, checking hp every 10 seconds
#ALA +10 {hp}
and then when hp and sp return to either full or a big fraction, restart atttacking until it dies and so on and so forth.
It is a mess, but the computers at uni do not allow zmud to install, so what I have just typed is basically what I have at home - there are typos in the statements, as it wasnt cut and pasted
Please help, and thank you if you do!
rob |
|
|
|
PrestoPimp Apprentice
Joined: 18 Sep 2001 Posts: 175 Location: USA
|
Posted: Wed Sep 17, 2003 5:30 am |
We got something like
#AL go {@enemydir;c @spell @enemy;@leavedir;checkstats}
#AL checkstats {#IF (@HP<@MAXHP/2)OR({@SP<@MAXSP/2) {#ALARM +10 {checkstats}} {#UNTRIGGER +10;go}
With Enemydir, spell, enemy, leavedir variables being self-explanatory. This should work rather well.. just adapt to your needs. |
|
|
|
robthesilent Newbie
Joined: 05 Oct 2002 Posts: 7 Location: Australia
|
Posted: Thu Sep 18, 2003 8:22 am |
Yes that makes sense and works. Thanks!
But now I have a system that would work as well (maybe) but it falls down because the hp and sp variables do not always update every time the hp display comes up. I think this is because the mud prompt is > which in zmud is a predefined variable, and I have tried ^ and $ in front of and behind the hp display in various combinations. I have also tried #DEF xxxxxxxx<X but nothing seems to work.
The hp display is
> [ HP: 341/348 SP: 497/540 ]
[ HP: 341/348 SP: 497/540 ]
with and without the mudprompt respectively.
What I want is a way to make the hp and sp variables correct every 10 seconds and then based on that, do things.
thankyou!
rob |
|
|
|
zwanth Beginner
Joined: 13 Jul 2002 Posts: 16 Location: USA
|
Posted: Thu Sep 18, 2003 4:06 pm |
If I read your message correctly, you are trying to capture hp and sp from the following prompt syntax:
[ HP: 341/348 SP: 497/540 ]
I would not use the ^ or $ tokens, as prompts do not always start or end on a line (at least on my MUD.) You should be able to capture it in this trigger pattern:
~[ HP~: (%d)~/(%d) SP~: (%d)~/(%d) ~]
and then in the action part of the trigger, assign the values to variables:
hp = %1
maxhp = %2
sp = %3
maxsp = %4 |
|
|
|
robthesilent Newbie
Joined: 05 Oct 2002 Posts: 7 Location: Australia
|
Posted: Thu Sep 18, 2003 7:15 pm |
That is perfect exactly what I was after.
TRIG: mmflay
ACT : #IF {@SP>@MAXSP/2)} {mflay;#ALA +10 {mmflay}} {'less;#ALA +10 {mmflay}}
This is the basic model, a self-looping trigger. Not very complex, but the idea is good. But I have had trouble with the #IF syntax.
#IF {@HP>@MAXHP/2}AND{@SP>@MAXSP/2} {attack fn} {wait fn}
#IF {@HP=@MAXSP}AND{@SP<@MAXSP-60} {sp steal fn} {wait fn}
doesnt work as a trigger. It is something to do with the syntax, but its a problem I am not solving. |
|
|
|
zwanth Beginner
Joined: 13 Jul 2002 Posts: 16 Location: USA
|
Posted: Thu Sep 18, 2003 7:27 pm |
quote: Originally posted by robthesilent
#IF {@HP>@MAXHP/2}AND{@SP>@MAXSP/2} {attack fn} {wait fn}
The correct syntax for this would be:
#IF (@HP > @MAXHP/2 and @SP > @MAXSP/2) {attack fn} {wait fn}
Remember to always use () for the first part of #IF statements, and {} for the rest. Try rewriting your #IF statements like that and they should work properly. |
|
|
|
|
|