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
whoever
Novice


Joined: 13 Jun 2023
Posts: 33

PostPosted: Thu Aug 03, 2023 2:35 pm   

Really do not get triggers and variables, some pointers would be nice
 
Hello All,

I have been reading the docs, looking at forums, looking at example scripts.

Still I'm not able to solve this simple issue.

The mud I'm on reports your health condition in this format:
[H1105 M2357 V1684]

Where H is the hitpoints, M is the mana, and V is the movement points.

Now what I want to do is have 3 variables (hit/mana/move) to store these in.

Somehow I can't get this to work.

I have tried:
[H{&hit} M{&mana} V{&move}]

[H&{hit} M&{mana} V&{move}]

[H(&hit) M(&mana) V(&move)]

[H&hit M&mana V &move]

and so forth. None of them work.

How to get this working?
Reply with quote
shalimar
GURU


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

PostPosted: Thu Aug 03, 2023 7:27 pm   
 
The issue in this example is that the square brackets have another meaning where pattern matching is concerned (it expresses a range of acceptable characters).

In order for you to get the trigger to match properly, and work as you intend, you need to preface 'special characters' with the escape character (a tilde: ~) so the client knows You mean that character literally.

Code:
~[H&hit M&mana V&move~]


This should work.
You can learn more about pattern matching in the help files: #HELP #TRIGGER
_________________
Discord: Shalimarwildcat
Reply with quote
whoever
Novice


Joined: 13 Jun 2023
Posts: 33

PostPosted: Thu Aug 03, 2023 9:09 pm   
 
First, thank you for taking the time to answer.

Although your example solution had some caveats, it did work for the most part, and I was able to solve the remaining issues.

Thanks a lot!
Reply with quote
whoever
Novice


Joined: 13 Jun 2023
Posts: 33

PostPosted: Thu Aug 03, 2023 9:14 pm   
 
the biggest issue is that it's behaviour isn't predictable

one time it'll go perfect..

but the next time I'll get for instance the hit variable filled with not only the hits, but everything after it.

So the value of the hit var is something like:
591 M220 V175] ex[] ><121301368>xp r[15707] [H591

where in this case 591 would have been the correct answer
Reply with quote
shalimar
GURU


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

PostPosted: Fri Aug 04, 2023 10:38 am   
 
Try this:

Code:
~[H&%d{hit} M&%d{mana} V&%d{move}~]


It forces to only match with integer values.
_________________
Discord: Shalimarwildcat
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