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 / random letters??????

Author
Message
highschool gamedude
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 9th Oct 2003 17:50
ok i am trying to make a thing that will print a random letter ... im sure there is like a really easy way or something but i just dont know it and cant think of it. i have tried everything i can think of such as arrays , setting each letter to a string and trying to get it to print a random string, and also a for x=a to z...next x. along with other things so please help me.

any tips (i just started with this program)
PoHa!84
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 9th Oct 2003 18:03
Um, x=a to z doesn't work. You have to use numbers in there. But try this example. It's probably not the best way to do it, but it works:



Just modify it to suit your wants...

Destroy you with my mind, I could!
. Cool, he is. Play his games, I do.
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 9th Oct 2003 18:35 Edited at: 9th Oct 2003 18:37


All the letters on the keyboard (and quite a few off) can be represented by number codes. a to z lower case is 97 to 122, and upper case A to Z is 65 to 90. This code randomizes an ascii code and puts it into character form using the chr$() function.

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
PoHa!84
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 9th Oct 2003 18:54
See? I knew there was a better way!

Destroy you with my mind, I could!
. Cool, he is. Play his games, I do.
highschool gamedude
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 9th Oct 2003 19:54
thank you both.. i am not on a computer wherei can try that right now

any tips (i just started with this program)
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 9th Oct 2003 20:15
Quote: "a to z lower case is 97 to 122, and upper case A to Z is 65 to 90. This code randomizes an ascii code and puts it into character form using the chr$() function."


This may be easier to remember if you know the binary alphabet.

Am I the only one here who's really confused?
In the shadow of the valley of death we need fear no evil

Login to post a reply

Server time is: 2025-05-20 15:06:18
Your offset time is: 2025-05-20 15:06:18