Register forum user name Search FAQ

Gammon Forum

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 ➜ experience counter - I need help!

experience counter - I need help!

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


Posted by DanPrice   Australia  (3 posts)  Bio
Date Thu 30 May 2002 02:49 PM (UTC)
Message
Iim trying to make an experience counter that just "counts" my experience. So, i made this trigger:

You receive * experience points.

and this calls this script:

Sub SCRExpCount (strName, strLine, aryWildcards)
dim newexp, exp
exp = world.GetVariable ("exp")
newexp = arywildcards(1)
exp = exp + newexp
world.setvariable "exp", exp
end sub

however, the number in the variable just 'melds' together, eg if i had 2500 as the variable and killed a mob that gives me 3500 it puts in 25003500
Im guessing this is as its treating it as a string, but i cant change this (because im not very good a coding :P). Can anyone help?

Would you like some gum?
Go on, its spearmint flavour....
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Thu 30 May 2002 03:14 PM (UTC)
Message

exp = CInt(exp) + CInt(NewExp)

The CINT function converts the value to an integer (number).

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #2 on Thu 30 May 2002 03:18 PM (UTC)
Message
By the way, if you want to make this subroutine shorter, you could do this:

Sub SCRExpCount (strName, strLine, aryWildcards) 
  World.SetVariable "exp", CInt(World.GetVariable("exp")) + CInt(aryWildcards(1))
End Sub

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Stoned00d   (14 posts)  Bio
Date Reply #3 on Sun 30 Jun 2002 01:24 AM (UTC)
Message
It's adding two strings, typecast them to integers
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.


17,440 views.

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

Go to topic:           Search the forum


[Go to top] top

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