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.

FPSC Classic Scripts / Keypressed script

Author
Message
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 13th Apr 2012 19:54
Hi All

Not good at scripting maybe sombody can tell me what I am doing wrong here. I want to bring up the compass by pressing the "P" key. Also pressing it again would turn it off. The reason being that the fps realy gets killed when it is showing.



Any help would be great.

Dennis

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
bruce3371
14
Years of Service
User Offline
Joined: 4th Aug 2010
Location: Englishland
Posted: 13th Apr 2012 19:59
Try using 'scancodekeypressed' instead of 'keypressed'

DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 13th Apr 2012 20:06
@ bruce3371

I tride that and it was the same thing. When pressing the P key nothing happens.

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
Corno_1
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 13th Apr 2012 21:26 Edited at: 13th Apr 2012 21:33
ok then try this:


hope i can help
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 13th Apr 2012 22:10
Compass just flashs on and off none stop if you hold the key down it stays on

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 13th Apr 2012 22:22 Edited at: 13th Apr 2012 22:33
The following is a compass script we use. It is bound to the P key, and you can change that by altering the value of the scancodekey value. I run this in v1.17, v1.18, and v1.19 with no issues. Attach it to a triggerzone in the level.



I also thought the "keypressed" command was something like this:

keypressed=25 1 --> means the P key was pressed
keypressed=25 0 --> means the P key was released

I am only asking because I do not use that command, but still use "scancodekeypressed" command.


Twitter: @NFoxMedia
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 14th Apr 2012 00:39
@ BlackFox

Thanks for the help and it works great. The only thing is I was hoping that when the compass was off the frame rate would come back but said to say it dosen't. But thanks for the help. I will try the keypressed=25 1 and keypressed=25 0 to see how that works out.

THANKS
Dennis

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
The Zombie Killer
13
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 14th Apr 2012 04:17
I generally don't use scancodekeypressed, because it doesn't offer me the ability to do something if the button is not pressed. And BlackFox is right about how to use keypressed.

Try this script, although BlackFox's should work just as well.



DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 14th Apr 2012 18:56
@T.Z.K.

I tride that and it works fine. I see how it works now. It is kind of a IF Then And Statement

Thanks for the insight all

Dennis

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed

Login to post a reply

Server time is: 2024-11-24 00:03:18
Your offset time is: 2024-11-24 00:03:18