Yoko

All sides of Injection
It is currently 2026-01-16 14:11:06

All times are UTC+02:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
 Post subject: string as number problem
PostPosted: 2010-01-17 04:46:03 
Offline

Joined: 2009-03-10 09:43:01
Posts: 78
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?


Last edited by xinxilas on 2010-01-17 05:24:53, edited 1 time in total.

Top
   
 Post subject:
PostPosted: 2010-01-17 04:49:44 
Offline

Joined: 2009-03-10 09:43:01
Posts: 78
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?


Top
   
 Post subject:
PostPosted: 2010-01-17 05:31:40 
Offline

Joined: 2005-04-19 18:00:29
Posts: 2259
Location: Московская область
Code:
sub test()
  var f = "1"
  uo.Print(STR(VAL(f)+1))
end sub


Result: 2


Top
   
 Post subject:
PostPosted: 2010-01-17 06:26:08 
Offline

Joined: 2009-03-10 09:43:01
Posts: 78
Very good...
f=(VAL(MID(a[n], 7, 1)))

it worked... :D


Top
   
 Post subject:
PostPosted: 2010-01-17 18:01:52 
Offline

Joined: 2005-04-19 18:00:29
Posts: 2259
Location: Московская область
I know :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited