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
➜ Jscript
➜ Using numbers...
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Okram
Italy (8 posts) Bio
|
Date
| Fri 31 Oct 2003 09:48 AM (UTC) |
Message
| Hallo, I wanted to parse numbers like that:
inventory
You are carrying:
[01] a sword
[02] a dagger
[03] a piece of meat [25]
so that I can keep track of pieces of meat I have.
I mean:
*[*] a piece of meat [*]*
and I want the "25" to go into an INTEGER variable, so I can do, say:
pieces_of_meat = integer("%3");
if (pieces_of_meat < 5) world.note("You have to buy meat!!!")
AND
do something like:
* gives you a piece of meat.*
pieces_of_meat = pieces_of_meat + 1;
Is there any way to "get number from string", using JScript in MushClient?
-okram- | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 02 Nov 2003 08:25 PM (UTC) |
Message
| Use parseInt - here is one reference to it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsmthparseint.asp |
- 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.
10,346 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top