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.

Dark GDK / Commands from DBpro

Author
Message
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 13th Sep 2010 01:53 Edited at: 13th Sep 2010 01:56
Would someone mind telling me the commands in GDK, the ones here are DB pro:
RND
RND Timer
Keystate
Inkey$

My biggest thing is how do I do this
If keystate(17)=1 then ...


Also if anyone has dark physics how do I add weight to the bottom of something so when I add forces it just moves and doesn't roll or flip.

I want coke, not Pepsi!
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 02:51 Edited at: 13th Sep 2010 02:51
RND : dbRnd (...);
RND Timer : well i'm not sure what it does, but you can try ( srand ( dbTimer ( ) ) )
Keystate : dbKeyState ( ... )
inkey : dbInKey ( ... ) (not sure if this exists, cant remember )

last:


also note you should use == and NOT =, == is for comparison, when = is for assigning values

CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 13th Sep 2010 03:02
ok, Now I just need to know this, thanks by the way

Quote: "
Also if anyone has dark physics how do I add weight to the bottom of something so when I add forces it just moves and doesn't roll or flip."


I want coke, not Pepsi!
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 13th Sep 2010 03:19
To add onto what Hassan has said, you can use dbRandomize( dbTimer() ); to re-seed the random number generator, though the method he told you with srand I belive is native C which is generally better to use but since your just starting out in GDK dbRandomize may be a better solution to start off, it is really up to you.

Just to be technical inkey is dbInKey$(), I found it strange it was listed under the core commands and not input, but anyways...

I'm not sure if your aware that there is a command list that comes with GDK. For the most part if you know the DBPro command it will be very easy to find in the GDK command list. From the start menu in your GDK folder there should be something called Information(i think?), if you can't find it there and you installed it to its default location it should be located at... C:\Program Files\The Game Creators\Dark GDK\Documentation ...having the quick reference at hand will save considerble time and is just generally usefull to read every now and then . Anyways and allways, best luck to you.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 13th Sep 2010 06:12 Edited at: 13th Sep 2010 06:13
Quote: "To add onto what Hassan has said, you can use dbRandomize( dbTimer() ); to re-seed the random number generator, though the method he told you with srand I belive is native C which is generally better to use but since your just starting out in GDK dbRandomize may be a better solution to start off, it is really up to you."

How would I get a random number say from 471 to 1783 or like -12 to 17?

I want coke, not Pepsi!
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 06:34 Edited at: 13th Sep 2010 06:37
It's about logic, you want a number between 10 and 20, you just actually need the "difference(delta)" between them, 20-10 = you only want a random number from 10, the rest is up to padding, (0 to 10) + 10 padding = (10 to 20)

example:


Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 13th Sep 2010 08:08
Once again to add onto what Hassan has said (no offense, and sorry.), But to put it simply it is about off-setting the number you desire. Think of the range you want to get, for example, 200-300 would be 0-99 but you add on the difference to get the actual number you want, which would be 200, So your 0-99 + 200 would be 200-300. Hope that made sense? and easier to understand, if not I appoligize, just trying to explain what is going on in Hassan's code.

Login to post a reply

Server time is: 2024-11-19 18:40:32
Your offset time is: 2024-11-19 18:40:32