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.

Newcomers DBPro Corner / How do i toggle?

Author
Message
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 15th Jul 2008 02:56
This is probably a dumb question with a dead simple answer but it eludes me right now. How can i get a single button to toggle an option? for example:-

Camera height = 200
Press "c"
camera height = 120
press "c"
camera height = 200

Kinda like pressing "c" to toggle crouch in an FPS if you get my drift...

I can see from your smile, you're not here for the sunset.
Moe
18
Years of Service
User Offline
Joined: 1st Apr 2006
Location: Sunny California
Posted: 15th Jul 2008 03:25
if c=0
camera height=200
endif

if c=1
camera height =120
endif

if scancode(45)=1

if c=1
c=0
endif

if c=0
c=1
endif

endif

The scancode command returns a one if that key is pressed. scancode(1) would return a one is the squiggly key was pressed. scancode(2), would be 1 key, scancode(3) would be two. scancode(30) would be A. etc. It's numbered numerically from the top right of the keyboard to the bottom left, excluding the arrowkeys, numpad, function buttons, and the home/insert etc. buttons.

parrot
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 15th Jul 2008 04:38
Check out this thread:

http://forum.thegamecreators.com/?m=forum_view&t=132790&b=1

I hope it helps.


Whatever...
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 16th Jul 2008 23:56 Edited at: 17th Jul 2008 00:09
for some reason it doesn't seem to register the "if scancode(45)=1" it says it's an illegal command and stuff...


*edit*
Nevermind, i got it. Used "If Keystate(45)=1" instead

I can see from your smile, you're not here for the sunset.
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 17th Jul 2008 11:06 Edited at: 17th Jul 2008 11:08
Wrong thread. Sorry.

But to add to the discussion, that thread you linked to helped a lot, Dabbler. I was having a bit of an issue with this myself.

a total noob.
Currently working on - A letter-by-letter Message Script

Login to post a reply

Server time is: 2024-11-25 02:07:34
Your offset time is: 2024-11-25 02:07:34