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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
mlparkerjr
Newbie


Joined: 04 Oct 2018
Posts: 8
Location: PA

PostPosted: Sat Oct 06, 2018 5:55 am   

Prompt Error fails to compile
 
I'm trying to use a trigger with a pattern to catch the prompt information and use the HP variable for when it drops below a certain number it will cast a spell or use a potion but nothing seems to be working. However the variable is capturing the correct number. This was working with 1 variable in the Module > Preferences > Sessions > Prompt

Mud Prompt

{100 HP 100 IP}

where first number is current HP and second is current influence/mana

Can't seem to figure out how to set 2 variables in the above Prompt wizard so....

Trying to utilize a trigger on prompt with pattern: ~{&hp HP &ip IP} text: {&hp HP &ip IP}

Script value

#IF (@hp < 200) {#wa 3000;c band}

when I refresh MUD prompt I get ERROR: Trigger "~&hp HP &ip IP}" fired but did not compile

It captures the correct HP and IP values but will not execute the IF statement.
Reply with quote
mlparkerjr
Newbie


Joined: 04 Oct 2018
Posts: 8
Location: PA

PostPosted: Sat Oct 06, 2018 6:05 am   
 
I know it's late/early and it's been awhile since I've done any coding but I believe I fixed my issue.

old script value

#IF (@hp < 200) {#wa 3000;c band}

New

#IF (@hp < 200) {#wa 3000;c band} {}

Helps if I would've finished the statement.
Reply with quote
mlparkerjr
Newbie


Joined: 04 Oct 2018
Posts: 8
Location: PA

PostPosted: Sat Oct 06, 2018 6:48 am   Issue with the firing IF statement
 
MUD Text

{196 HP 54 IP}: use blood
Your wounds begin to close.
You heal 99 hit points.
You drank some of the blood potion.
{273 HP 54 IP}: use blood
Please wait 3 more seconds.

with a quick test with #IF (@hp < 200) {#wa 3000;use blood} {}

even though I have trigger set to 'on prompt' it's still throwing another use blood again even though the value of @hp has been updated to provide the IF with a false.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Sat Oct 06, 2018 11:07 am   
 
Alright, to you have a trigger to actually capture and store the value of your HP?
Also, if you have a 3 second delay, you could be healing yourself from the previous prompt instead of the current one.

Do the #WAIT first, and then do the #IF check at the end to see if it is still needed.
_________________
Discord: Shalimarwildcat
Reply with quote
mlparkerjr
Newbie


Joined: 04 Oct 2018
Posts: 8
Location: PA

PostPosted: Sat Oct 06, 2018 2:40 pm   
 
Yea the trigger I have captures the correct value when the prompt is refreshed. Which is why I don't understand it would throw another true value out immediately following the refresh. so now I have

pattern: ~{&hp HP &ip IP} 'trigger on prompt'
value: #wa 3000; #IF (@hp < 100) {use blood} {}

see if this works
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Sat Oct 06, 2018 4:24 pm   
 
How often do you receive the prompt?
I still think the #WAIT is the issue, especially if you get two prompts, heal yourself, then don't get another prompt before the second #WAIT ends, thus not having an updated @hp value.

You want to either not worry about being told its too soon to use it again (you can #GAG the message with a separate #TRIGGER).
Issue a command to update the variable values.
Use names #ALARMs instead of #WAIT to make sure there is only ever one instance on the stack.
Or you want to have a separate tracker to turn of that power for those three seconds.

For that your current trigger would only do:
#IF (@hp < 100) {#IF (@blood=0) {use blood}}

Then you can make a separate trigger:
#TRIGGER {Message when you use blood} {blood=1;#ALARM "nextBlood" +3 {blood=0}}
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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