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
➜ VBscript
➜ XP Counter
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Simon
Sweden (39 posts) Bio
|
| Date
| Sat 18 Aug 2001 07:38 AM (UTC) |
| Message
| Hey, I am working on an xp counter but I'm not really getting it working :(
This is what I am triggering on:
You have 496,903,292 total xp, with 6,786,388 to next level and 24,325,293 to level.
I set those to 3 different variables, TotXp, XpTNL and XPToSp.
Then I want it to count over how much xp I made the last hour, and how much I've made the last 10 hours. So I figure I'd have to add some variables and a timer! I've never worked with timers before so I have no idea how to do that :( |
- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9 | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 19 Aug 2001 06:58 AM (UTC) |
| Message
| The first part is pretty easy, working out the current amounts and putting into a variable, something like this:
Trigger: You have * total xp, with * to next level and * to level.
Label: Experience
Script: Experience
The script below would collect that data, strip the commas from the numbers, convert into doubles (which will hold a large number) and put into variables.
However knowing how many you go "in the last hour" is a bit trickier. I don't think a timer would help, however you could investigate using the "Now" function to find the current time, and the "DateDiff" function to find how many hours have elapsed.
I don't know how to easily do all that without maintaining a list of how many XP you had, say, every hour, and comparing your current one to the one in that list.
I hope that gives you something to go on with ...
Sub Experience (strTriggerName, trig_line, arrWildCards)
dim TotXp, XpTNL, XPToSp
' get rid of commas and convert to a double (floating point number)
TotXp = CDbl (world.Replace (arrWildcards (1), ",", "", true))
XpTNL = CDbl (world.Replace (arrWildcards (2), ",", "", true))
XPToSp = CDbl (world.Replace (arrWildcards (3), ",", "", true))
world.SetVariable "TotXp", TotXp
world.SetVariable "XpTNL", XpTNL
world.SetVariable "XPToSp", XPToSp
End Sub
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Simon
Sweden (39 posts) Bio
|
| Date
| Reply #2 on Sun 26 Aug 2001 10:56 AM (UTC) |
| Message
| hmm ok... I worked a bit on it and got most of it working.. just one problem, is there any way to get a different formatting on the date diff than just the one that shows the amount of seconds that has passed? (using the "s" in it)
Thanx for the help :)
/Simon |
- "Where do you live, Simon?"
- "I live in the sick and wounded, doc."
Session 9 | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sun 26 Aug 2001 10:09 PM (UTC) Amended on Sun 26 Aug 2001 10:10 PM (UTC) by Nick Gammon
|
| Message
| Sure, you have the following options:
- yyyy - Year
- q - Quarter
- m - Month
- y - Day of year
- d - Day
- w - Weekday
- ww - Week of year
- h - Hour
- n - Minute
- s - Second
|
- 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.
18,684 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top