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
Virus
Wanderer


Joined: 29 Jun 2002
Posts: 69
Location: USA

PostPosted: Fri Feb 14, 2003 5:22 pm   

Trigger Help
 
Ok, I have a trigger:
^You have been hit for (%d) points of damage in the ({Head|Center Torso|Center Torso ~(rear~)|Left Torso|Left Torso ~(rear~)|Right Torso|Right Torso ~(rear~)|Right Arm|Left Arm|Left Leg|Right Leg}){~(transfer~)|}$

Whats its set up to do is:
#GAG
loc = %replace(%2,"(","")
loc = %replace($loc,")","")
loc = %replace($loc," ",_)
#SH %ansi(high,red)DAMAGE!!%ansi(high,white) %1 to %2
damage_taken = %eval($damage_taken + %1)
#VAR $loc %eval(${$loc} - %1)

When I get a damage emit it works fine. But when I get several it mixed them up due to the variable loc that I created. (Oh, bear in mind that I change @ to $). Is there an easier way to do the replacements that I need done then what I did? I need to make ( and ) turn into nothing "" and I need spaces " " turned into _. Ok.

Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com
Reply with quote
Virus
Wanderer


Joined: 29 Jun 2002
Posts: 69
Location: USA

PostPosted: Fri Feb 14, 2003 8:32 pm   
 
Ok, the problem I was having is I was writing to then claling the same variable 3 times in that script. I fixed it by simply typing %replace(%replace(%replace(%2,"(",""),")","")," ",_)

Also, instead of writing to a variable I used it right inside the code I needed.

Heres what I used:
#GAG
#SH %ansi(high,red)DAMAGE!!%ansi(high,white) %1 to %2
damage_taken = %eval($damage_taken + %1)
#VAR %replace(%replace(%replace(%2," ",_),"(",""),")","") %eval(${%replace(%replace(%replace(%2," ",_),"(",""),")","")} - %1)


Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com
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