Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Another small and annoying problem

Author
Message
kRx
20
Years of Service
User Offline
Joined: 2nd Apr 2005
Location: Canterbury, Kent, UK
Posted: 4th Apr 2005 05:45
i am using the 'text x,y,string' code

what i want printed to the screen is a number eg/ 100. i am having to convert the number into a string using str$(). what i want to do is to decrement the number but i cant find away to convert the string back to a number and decrmement it and reprogram it as a string i have tried a variaty of this such as val() etc... is there another way to do this as i think im quite wrong

kR
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 4th Apr 2005 07:34
for i=1 to 100
text rnd(600),rnd(400),str$(i)
wait 100
next i

ten seconds worth of numbers counting up as they fill your screen, if you do the str$ inside the text command then the value I remains a number and only ever gets converted to a string inside the text command, if you wanted the number to become a string then do

number$=str$(number)

and that makes your number a string, hope thats some help.

Mentor.

PC1:XP, P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro, 6 way speakers.
PC2: Linux, AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
PC3: XP, laptop, intel 2.6ghz celeron, ATI mobility 9000, 256mb
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Apr 2005 22:51
U said "decrement" right?
DON'T forget to use "step -1" if u are using the for/next command.



I needed 3 hours to see it's wrong
kRx
20
Years of Service
User Offline
Joined: 2nd Apr 2005
Location: Canterbury, Kent, UK
Posted: 7th Apr 2005 05:41
Thanks for ur time guys all sorted now

kR

Login to post a reply

Server time is: 2025-05-23 12:57:40
Your offset time is: 2025-05-23 12:57:40