Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
testtoro
Newbie


Joined: 02 Mar 2009
Posts: 2

PostPosted: Mon Mar 02, 2009 1:36 pm   

Need Help with a small trigger/script
 
Hello. I am having a bit of problem. I am playing a mud with a character that does not flee from combat when low on health.
I need a little trig/script that checks the min HP and which makes the character run into a certain direction which I set before engagin combat.
Here is how the HP/PSI/END line looks.
[ HP: 2232/2232 PSI: 131/131 END: 1506/1506 ]

The min HP could be either %(percent) based or a number which I specify so when my hp drops below this my char goes into a certain direction.
Anyone can be please help?
Thank you in advance for your time.
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Mar 02, 2009 4:11 pm   
 
This is the wrong forum, though I'm sure a nice GURU will move it for you ;) Questions like this belong in the general zMUD forum as they'll tell you when they move it. I'll give you an example of my status bar trigger for another MUD which you can work from. It shows a lot of things you can do with your hp/ma/mv/psi/etc etc... It has math functions to determine the percentage, and is setup for multiplaying. This is an old old version that only works with preset characters. I have a new version I won't share that works with unlimited characters and only shows the ones which are connected. Enjoy.

Code:
#CLASS {Stats Bar}
#ALIAS statupd {
  #IF (((%float( @katya.hp) / %float( @katya.maxhp)) * 100) < 35) {katya.hpcolor = "bold,high,red"} {katya.hpcolor = "bold,magenta"}
  #IF (((%float( @cruin.hp) / %float( @cruin.maxhp)) * 100) < 35) {cruin.hpcolor = "bold,high,red"} {cruin.hpcolor = "bold,magenta"}
  #STAT %ansi( bold, black)Katya: Hp:%ansi( @katya.hpcolor)@katya.hp%ansi( bold, black), Ma:%ansi( bold, magenta)@katya.ma%ansi( bold, black), Mv:%ansi( bold, magenta)@katya.mv %ansi( bold, high, red)~| %ansi( bold, black)Cruin: Hp:%ansi( @cruin.hpcolor)@cruin.hp%ansi( bold, black), Ma:%ansi( bold, magenta)@cruin.ma%ansi( bold, black), Mv:%ansi( bold, magenta)@cruin.mv
  }
#TRIGGER {(%d)hp (%d)m (%d)mv>} {
  :katya:yuni.hp = %1
  :katya:yuni.ma = %2
  :katya:yuni.mv = %3
  :katya:statupd
  :cruin:yuni.hp = %1
  :cruin:yuni.ma = %2
  :cruin:yuni.mv = %3
  :cruin:statupd
  } "" {nocr|prompt}
#TRIGGER {~[(%s)(%d)~/(%d)(%s)~]~[(%s)(%d)~/(%d)(%s)~]~[(%s)(%d)~/(%d)(%s)~] ~[(%s)(%d)~] ~[(%s)(%d)~] ~[(%d) (%w)~] (%w)} {
  #IF (%19 = "Katya") {katya.maxhp = %3}
  #IF (%19 = "Cruin") {cruin.maxhp = %3}
  }
#TRIGGER {~[ (%w) advanced to level (%d) ~]} {#IF (%1 = "Katya" | %1 = "Cruin") {gr}}
#CLASS 0
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 02, 2009 4:36 pm   
 
ralgith wrote:
This is the wrong forum, though I'm sure a nice GURU will move it for you ;) Questions like this belong in the general zMUD forum as they'll tell you when they move it.

What he said.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
testtoro
Newbie


Joined: 02 Mar 2009
Posts: 2

PostPosted: Mon Mar 02, 2009 4:48 pm   
 
Thank you for your post Ralgith and I apologise for posting in the wrong place.
Even though your code tell me alot it also confuses me alot :).
Still looking for a small understandable example/script/trig :)
thank you again
Reply with quote
Ralph1971
Wanderer


Joined: 01 Mar 2008
Posts: 64

PostPosted: Mon Mar 02, 2009 5:28 pm   
 
this might help a little..
Code:

#al prep {#pr dir "Flee direction?"}
#tr {~[HP: &currhp/&maxhp} {#math health {@maxhp/@currhp*100};#if (@health<50) {flee @dir}}



Kick it off by setting the flee direction with the alias prep (you can also quaff potions, cast spells with this.. just add the commands
The first line asks you the direction you want to flee..
second reads in your health into variables and then processes it. If it's less than 50%, you flee otherwise, you stay there. You can change the 50 to whatever percentage you want to have remaining before you run like a rabbit. NOTE: this is set to fire every time the prompt is displayed. Could cause some processing issues on older/slower machines.
You can set it off in a class of it's own so it only fires during combat. Another option is to set your prompt variables in View->Settings->MUD Prompt
untested in 7.21... but should work. If, for some reason it doesn't, the zMud help files are awesome
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net