SRL Archive - OSR Help

converting a string to int


x[Warrior]x3500

2012-04-27 03:08:50

so Val() is the way to convert it in Pascal, but simba apparently does not support this:

[Error] (897:32): Unknown identifier 'Val' at line 896
Compiling failed.

so after trying to figure this out for ever, i have finally given up and decided to ask if you guys knew. any ideas on how i can convert a string '1' to int 1?

mormonman

2012-04-27 03:13:40

StrToInt

x[Warrior]x3500

2012-04-27 03:18:06

LOL dude i literally spent like 2 hrs trying to find that stupid function (for some reason, i never expect it to be so correctly named) and like 2 mins after i posted this, i found it XD. thanks though mormonman! man was that torturing me :/

Sex

2012-04-27 03:31:43

You can use ToStr() as well; it accepts most every type.

x[Warrior]x3500

2012-04-27 03:33:27

From: Sex
You can use ToStr() as well; it accepts most every type.


that turns it into a string, i was tryin to do the opposite. im just gunna say this is my body telling me that i really need sleep :).

Sex

2012-04-27 15:34:53

From: x[Warrior]x3500
that turns it into a string, i was tryin to do the opposite. im just gunna say this is my body telling me that i really need sleep :).


Ah, my bad, didn't read your post correctly :).

Brandon

2012-04-27 15:53:37

StrToIntDef is much safer IMO.. That way if it cannot convert it will have a default value.