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 / Acessing Random Numbers

Author
Message
DivW
21
Years of Service
User Offline
Joined: 31st Jul 2003
Location: Scotland
Posted: 7th Feb 2004 00:21
Hey, it's been a while since i've posted, this is because i've not really been stuck. And i'm not really stuck right now either, but i want to know some things...

1) I'm not 100% sure how to explain this, so i'll just say it as it is. I have 30 random numbers between 1 to 98 stored in an array. Example:


The above code doesn't show what happensif 2 numbers are the same: pretend that doesn't happen just now please.
What i want to do is use a simple peice of code to check the numbers of all these to all do the same function. To clarify: out of 98 possibilities, if any out of those 98 return a 1 value for being in the 'list' of numbers, then i want it to run a certain function. I know i can do this with an endless stream of iff commands but if there is a faster way of doing it it will reduce my actuall code a millionfold. (I have 3 such arrays, one with 15, onewith 20, one with 25-the 30 one is just for the example).

2) How can i make the "Suspend for Keypress" command only unpause when the spacekey is pressed? This isn't as important, because it's going to be taken out when i advance the code to the next level, but it's still something i'd like to know.

-Thanks for any replies.
-Dave

Your soul...it tastes like chicken

Official Website Coming Soon
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Feb 2004 00:45 Edited at: 7th Feb 2004 00:46
1)


2) You need to create a loop, and only exit the loop when the KeyPress is the spacebar, otherwise, keep looping!

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
DivW
21
Years of Service
User Offline
Joined: 31st Jul 2003
Location: Scotland
Posted: 7th Feb 2004 01:35
I've created a loop, i'm doing that temporarily, but i wanted to know if the suspend command could be utilised instead to maximise efficiency. Thanks for that peice of code, i'll take a look at it tommorow and see if i can imliment it. Ta BatVink.

-Dave

Your soul...it tastes like chicken

Official Website Coming Soon

Login to post a reply

Server time is: 2025-05-22 12:28:03
Your offset time is: 2025-05-22 12:28:03