[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  XP Counter
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

XP Counter

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Simon   Sweden  (39 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,478 posts)  [Biography] 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
[Go to top] top

Posted by Simon   Sweden  (39 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,478 posts)  [Biography] 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
[Go to top] 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.


5,033 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]