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 / strings n variables

Author
Message
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 29th Mar 2009 18:04
is there any way to take like a for-next loop and turn the current value into a string?

maybe i need to check if a,b,c,d... to say k were equal to a certain vaule, could i use a for-next loop in this scenario?
Ed222
17
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 29th Mar 2009 19:40
You could store the values in arrays then use the for and next loop.
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 29th Mar 2009 21:11
As in current value, you mean an integer variable?

If so, I would store them in an array and cycle through them, and use the STR$() command. i.e.



~QJ
That's what they WANT you to think...
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th Mar 2009 23:39
sounds like you want ascii() and char$()
ASCII is how characters are stored in a computer, every symbol has a number (ie A=65).
ascii(n$) gives you the ascii value of n$, i think it only does one character though.
chr$(n) will convert an ascii value into the corresponding character.

The Universe has been erased by a mod because it was larger
than 240x80 pixels.
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 29th Mar 2009 23:54
just thought of something, could u use an array and say



then wen im ready to check id just use

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 30th Mar 2009 00:23
Do you mean something like

then no you can't. The variable "a" and ascii character "a" are not the same thing, ie if you declare a=5 you aren't actually changing the value of the letter a.

peculiury though i seem to remember you can state 2=1 and use 2 as if it it were a 1

The Universe has been erased by a mod because it was larger
than 240x80 pixels.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 30th Mar 2009 00:34
huh? you can actually do that in dbc? was it a accident!?

New Site! Check it out \/
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 30th Mar 2009 00:50
and no, im just setting the info into the variables, then copying the info over into an array then using that to check rather than the variables themselves
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 30th Mar 2009 01:16
oh you mean like labels?

YEAh that would work, i used to put all my variables in the same array and do that
i've found it much easier to use separate arrays though.

The Universe has been erased by a mod because it was larger
than 240x80 pixels.

Login to post a reply

Server time is: 2025-08-08 20:42:40
Your offset time is: 2025-08-08 20:42:40