|
whoever Novice
Joined: 13 Jun 2023 Posts: 33
|
Posted: 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? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
whoever Novice
Joined: 13 Jun 2023 Posts: 33
|
Posted: 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! |
|
|
|
whoever Novice
Joined: 13 Jun 2023 Posts: 33
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
|
|