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
➜ Adding Variables
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Zeppy
USA (15 posts) Bio
|
| Date
| Tue 24 Apr 2001 06:28 PM (UTC) |
| Message
| Please excuse my ignorance if this seems to obvious a question...
I am in the process of creating a stat roller for a MUD. I have created the needed triggers and have all the variables set up as needed within the script. I am attempting to add the totals for the stats. As it stands now, I have variables for each stat (i.e. Str, Wis, Int, etc...). The problem is that when I attempt to add them, the variables are concatenated instead of summed.
The command I use is a simple - total = str + wis + int
I assume this is because the script thinks that the variables are strings and not integers. How would I modify this?
BTW...I tried to change the trigger so that I was using a regular expression. After some trial and error, I managed to get the trigger to send only the numbers to the variables. This time though instead of concatenating or adding them in the script, I simply get an invalid class error. (That's not the exact error, but I think you will catch my drift.) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 24 Apr 2001 09:25 PM (UTC) |
| Message
| Just convert them to integers, like this:
total = cint (str) + cint (wis) + cint (int)
As for the invalid class error, it sounds like a bug in the script. Post your script (the part with the error) and also, you can copy and paste the exact error message from the error screen. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Zeppy
USA (15 posts) Bio
|
| Date
| Reply #2 on Wed 25 Apr 2001 03:10 PM (UTC) |
| Message
| So it was a rocket science issue!
Sheesh...you'd think I'd read a book or something!?
Anyhow, thanks for the help. As far as the code that caused the error, it's really a waste. Now that I see how to properly add the variables I will have no need for that particular script. Thanks though...
| | 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.
20,372 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top