Yoko
http://forum.yoko.com.ua/

string as number problem
http://forum.yoko.com.ua/viewtopic.php?f=3&t=15457
Page 1 of 1

Author:  xinxilas [ 2010-01-17 04:46:03 ]
Post subject:  string as number problem

sub plate()
var f,n,x=1
dim a[6]
a[1] = '0x1415 0'; Chest
a[2] = '0x1411 1'; Legs
a[3] = '0x1414 0'; Gloves
a[4] = '0x1413 1'; Gorget
a[5] = '0x1410 1'; Arms
a[6] = '0x1412 0'; Helmet
repeat
for n=1 to 6
f=MID(a[n], 7, 1)
uo.msg(f)
if f==1 then
...

Look..
It is all okay...
f for n=1 is 0
f for n=2 is 1
etc...
the msgs shows it allright...

But.. when i verify it here: if f==1 then
none of them return true

and...

if i put if f>1 then
all of them return true...

what should i do?

Author:  xinxilas [ 2010-01-17 04:49:44 ]
Post subject: 

well i fixed..

if f=='1'

i need to transform the valour of f
to NUMBER, and not text...


because i need to do things like that:

f=f+1

What can i do?

Author:  Scripts Writer [ 2010-01-17 05:31:40 ]
Post subject: 

Code:
sub test()
  var f = "1"
  uo.Print(STR(VAL(f)+1))
end sub


Result: 2

Author:  xinxilas [ 2010-01-17 06:26:08 ]
Post subject: 

Very good...
f=(VAL(MID(a[n], 7, 1)))

it worked... :D

Author:  Scripts Writer [ 2010-01-17 18:01:52 ]
Post subject: 

I know :)

Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/