Using numbers...

Posted by Okram on Fri 31 Oct 2003 09:48 AM — 2 posts, 12,811 views.

Italy #0
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-
Australia Forum Administrator #1
Use parseInt - here is one reference to it:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsmthparseint.asp