
-----------------------------------
beamer
Fri Nov 11, 2005 12:45 pm

strint help
-----------------------------------
does anyone know how to get strint to work? I can't seem to get my inputed number to convert into a number to compare with a sum of 2 random numbers  :( .  any help would be greatly appreciated.

-----------------------------------
Tony
Fri Nov 11, 2005 1:03 pm


-----------------------------------

put strint ("1") + 1

or just have user input the number directly

var num : int
get num
put num + 1

then there's no need for strint()

-----------------------------------
codemage
Fri Nov 11, 2005 1:05 pm


-----------------------------------
Like so:

var s : string
var i : int

get s % ie s = "12345"
i := strint(s)

-----------------------------------
MysticVegeta
Fri Nov 11, 2005 6:58 pm


-----------------------------------
I suggest that you also pay a little attention to the "strintok" command. Useful for errortraping later.

-----------------------------------
do_pete
Mon Nov 14, 2005 11:37 am


-----------------------------------
yeah you could go:
var input : string
var interger : int
loop
    put "Enter a number: " ..
    get input
    exit when strintok (input)
end loop
interger := strint (input)


-----------------------------------
codemage
Mon Nov 14, 2005 1:00 pm


-----------------------------------
Even better if you give the user some feedback on incorrect input.

loop 
    put "Enter a number: " .. 
    get input 
    exit when strintok (input) 
    put "How about an actual number this time, wiseguy."
end loop 


-----------------------------------
wtd
Mon Nov 14, 2005 1:24 pm


-----------------------------------
Even better if you give the user some feedback on incorrect input.

loop 
    put "Enter a number: " .. 
    get input 
    exit when strintok (input) 
    put "How about an actual number this time, wiseguy."
end loop 


If it helps so see the control flow a bit more clearly.

loop 
    put "Enter a number: " .. 
    get input
 
    if strintok (input) then
        exit
    else
        put "How about an actual number this time, wiseguy."
    end if
end loop 

