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
➜ How do I make an Experience Counter
How do I make an Experience Counter
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Trigger
(5 posts) Bio
|
Date
| Thu 01 Mar 2007 03:19 PM (UTC) |
Message
| Ok heres another good one that I know will envolve variables. Keep in mind That I have no idea how this program works on variables and triggers because copying and pasting a trigger doesnt really help me to much. Script wise that is. Although I havent really tried to hard for the capitals cause I got it typed 4 times instead of one. Either way you guys are awsome.
Anyways back to the question at hand. I want MUSHclient to count the experience gained from a mob kill.
You receive 150 experience points.
You receive 150 experience points.
and every time I type xp I want it to say
300 xp
untill I kill another mob
You receive 150 experience points.
In whitch it will say you have gained 450 xp
I suppose I want it to say
You have gained a total of 450 xp since last reset.
Any chance you lady's and gents could give me a hand with this without making it to complicated?:)
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 01 Mar 2007 07:51 PM (UTC) Amended on Thu 01 Mar 2007 07:52 PM (UTC) by Nick Gammon
|
Message
| I was going to suggest searching the forum, but previous posts on this subject seemed to use VBscript, and I prefer to script in Lua these days.
As a style issue can you please use [mono] for output from the MUD rather than bold? Bold is really for emphasis, but mono (or code) is better to show monospaced output.
To make an experience counter, you really just need to keep adding experience gains into a variable. This variable will be stored when you save the MUSHclient world file (if you save it). Here is what I had:
<triggers>
<trigger
enabled="y"
match="You receive * experience points."
send_to="12"
sequence="100"
>
<send>
SetVariable ("xp", (GetVariable ("xp") or 0) + %1)
Note ("You have gained a total of " ..
GetVariable ("xp") .. " xp since last reset.")
</send>
</trigger>
</triggers>
<aliases>
<alias
match="resetxp"
enabled="y"
send_to="12"
sequence="100"
>
<send>
SetVariable ("xp", 0)
Note "xp reset to zero"
</send>
</alias>
<alias
match="xp"
enabled="y"
send_to="12"
sequence="100"
>
<send>
Note ((GetVariable ("xp") or 0) .. " xp")
</send>
</alias>
</aliases>
The first part is a trigger to match on the experience gain line, and this adds to the "xp" variable, and notifies you of the new number.
The alias "xp" reports the current value, and the alias "resetxp" resets the variable to zero. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Trigger
(5 posts) Bio
|
Date
| Reply #2 on Thu 01 Mar 2007 11:05 PM (UTC) Amended on Thu 01 Mar 2007 11:50 PM (UTC) by Trigger
|
Message
| Yo thank you guys a million for your helping me in triggers because I read alot of the stuff you guys wrote in the past but it doesnt help me half as much as you just did man.
Everything he wrote worked!
Heres another one.
I want that same xp counter to also count the gold I pick up.
Anyway to do this without making 4 aliases?
| Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #3 on Fri 02 Mar 2007 04:16 AM (UTC) |
Message
| You will either have to have a seperate trigger for each possible way of displaying how much gold you gain, or one really long, messy regex trigger. I have a gold monitor I use, with about 8 triggers for various gold gains, and another one to remove gold you split with party members. I just tossed the functions into the world script file, and had the triggers call that script, so I only needed about three functions, saving a bit of space and effort for me. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Fri 02 Mar 2007 04:45 AM (UTC) |
Message
| Since you are matching on a different message, and adding to a different counter, it is probably simplest to copy the general idea for the experience counter, but duplicate it, for a gold counter. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
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.
15,026 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top