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
mbrodieAU
Newbie


Joined: 09 Apr 2006
Posts: 2
Location: Australia

PostPosted: Sun Apr 09, 2006 1:12 pm   

Help with script please :)
 
I have been trying really hard to write a script for a mud i play. basically if you die in it you lose stats and i dont wanna lose stats.. so i wanna make a script so when my health goes under 1500 i do certain actions, the prompt is 2 lines and looks like this


<Health [4,180] Armor [240] Energy [32,228]>
<Powerlevel [45,814,694/45,814,694]>

and this is the script i have come up with

#TR {~<Health [(%n)] Armor [(%n)] Energy [(%n)]~>}{#IF (%1 < 1500) { w;w;#wait 80000;gstat cha;e;e }}{} {nocr|prompt}

now i have no idea what i'm doing wrong, but i'm getting no response out of it whatsoever.. i've tried putting different things into the trigger field and syntax field.. and i've tried putting everything into the syntax field, i've changed options and stuff around i just cant work out what todo... i'm not sure if the fact that the health part has a , in it makes any difference, but any help would be greatly appreciated..

Thanks

Matt
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Apr 09, 2006 5:27 pm   
 
looks like the [] are part of the text. [] denote range patterns in trigger patterns, and since you aren't quoting them are removed when evaluated. You're ending up with a trigger pattern like this:

<Health 4,180 Armor 240 Energy 32,228>

Put a tilde in front of each [ and ] and your trigger should match.

EDIT: also, the use of #WAIT in triggers is a really bad thing
_________________
EDIT: I didn't like my old signature
Reply with quote
mbrodieAU
Newbie


Joined: 09 Apr 2006
Posts: 2
Location: Australia

PostPosted: Mon Apr 10, 2006 1:10 pm   
 
ok so i've changed it to this

#TR {~<Health ~[(%n)~] Armor ~[(%n)~] Energy ~[(%n)~]~>}{#IF (%1 < 3000) { w;w;#wait 80000;gstat cha;e;e }}{} {nocr|prompt}

and i still dont seem to be getting anywhere, it just doesnt seem to trigger, i got a question
what am i supposed to put into pattern and what do i put into syntax.. now i tried putting everything into syntax
and leaving the name of it blank, but that didnt do anything, i also tried putting the whole script into pattern but that didnt do anything
and i've tried breaking up the prompt part into pattern and the action into syntax area.. i hope that sheds a little more light on the subject
and again any help would be greatly appreciated..

Thanks

Matt
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Apr 10, 2006 1:33 pm   
 
You seem to be missing spaces in between curly braces }{, though that could be just the way you posted and not part of your script. Also, I recommend against using #WAIT, especially for such a long delay. Use #ALARM or a #CONDITION (to add a second state with the Wait type) instead.
Reply with quote
talonfreak2003
Beginner


Joined: 02 Dec 2004
Posts: 27
Location: Kansas... whippie!

PostPosted: Wed Apr 12, 2006 7:27 am   
 
<Health [4,180] Armor [240] Energy [32,228]>

#TR {^<Health ~[(%d)~] Armor ~[(%d)~] Energy ~[(%d)~]>}

Might possibly work. Problem you might be having is the value of health having a non numbered comma.
#IF {%1 <= 1500} {commands}
_________________
Yes, I'm a programing newb, but I can fix a car faster than you can spin your head.
Reply with quote
talonfreak2003
Beginner


Joined: 02 Dec 2004
Posts: 27
Location: Kansas... whippie!

PostPosted: Sun Apr 16, 2006 4:54 am   
 
Alright, I had him change his prompt around abit, I tried writing something for him, this is what I wrote
Quote:

#CLASS {Dam_calc} {disable}
#VAR dmg {}
#VAR last_hp {1679}
#TRIGGER {^~((%d)Health (%d)Armor (%d)energy~)} {#IF ("@last_hp" > "%1") {#SHOW HP Lost: %eval( "@last_hp" - "%1")};#VARIABLE last_hp "%1";#IF ("@last_hp" < "4,000") {w;w;gstat;#WAIT 80000}}
#CLASS 0


Basically, I took a small damage script I used to have, that works, and tried to modify it for his, and it's still getting nothing. Posting it here so that maybe someone who's a little more experienced might be able to help
_________________
Yes, I'm a programing newb, but I can fix a car faster than you can spin your head.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Sun Apr 16, 2006 12:31 pm   
 
why did you change the trigger pattern?

Code:

<Health [4,180] Armor [240] Energy [32,228]>


IS

Code:

#TR {^~<Health ~[(%d)~] Armor ~[(%d)~] Energy ~[(%d)~]~>}
Reply with quote
donki1
Beginner


Joined: 02 Oct 2004
Posts: 12

PostPosted: Tue Apr 18, 2006 8:52 am   
 
#TR {~<Health ~[(%n)~] Armor ~[(%n)~] Energy ~[(%n)~]~>}{#IF (%replace(%1,",","") < 1500) { w;w;#wait 80000;gstat cha;e;e }}{} {nocr|prompt}

I would try this.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Tue Apr 18, 2006 3:25 pm   
 
always anchor then with ^ so they arent triggered if someone else is telling you their statistics. also to prevent abuse. Some people who just have no integrity would use this to force you to (SLEEP or cast) because you have triggers to take action when your stats are low. People always find a way to try and exploit others.
_________________
Confucious say "Bugs in Programs need Hammer"
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