Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Storing a variable
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rinor
(16 posts) Bio
|
Date
| Mon 18 Apr 2005 01:40 AM (UTC) |
Message
| I'm trying to capture the hitpoints in my prompt and store it in a variable. This is the prompt: [DH][MH][sq]:[918hp]-[309m]-[610mv]-[100br]:[v] . I'm using ^\[DH\]\[MH\]\[sq\]\:\[\d+hp\]\-\[309m\]\-\[610mv\]\-\[100br\]\:\[v\] $ for the trigger. The problem is that I don't know what to do after this. %0 would send the whole line to a variable where as I only want the amount of my hitpoints.
Thanks for any help | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Mon 18 Apr 2005 04:13 AM (UTC) |
Message
| ^\[DH\]\[MH\]\[sq\]\:\[\d+hp\]\-\[309m\]\-\[610mv\]\-\[100br\]\:\[v\] $
You should PROBABLY make it:
^\[DH\]\[MH\]\[sq\]\:\[(\d+)hp\]\-\[\d+m\]\-\[\d+mv\]\-\[\d+br\]\:\[v\] $
Since, otherwise it will ONLY match when m=309 mv=610 and br=100 (you might also want to make the other things variable? I dont know, depending on if they change).
And you surround the thing in parenthesis (\d+) and then you can use %# where the number is the parenthesis number (or you can assign them names). In this case your hp (notice the (\d+)hp) will be in %1.
You might also think about making it a little more lax (either by removing the $ or adding a .* to the end) if your commands (or any other output) ever ends up on the prompt line. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Rinor
(16 posts) Bio
|
Date
| Reply #2 on Tue 19 Apr 2005 06:20 PM (UTC) |
Message
| |
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
12,397 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top