Scripts / [SOLVED] Prompt to use flash light. need help please

Author
Message
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 16th Jul 2019 07:21
Hi all , i know this sound stupid but i can not get it right.
i have made a small script to make a sound when the F key are pressed for the flash light that part work
My problem is ... I only want the prompt part : Prompt (" Press F for flash light ") to only prompt if the flash light is off.
but it stays on .
please check my script and help me.



Thanks for any help.
Pcs
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

The author of this post has marked a post as an answer.

Go to answer
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jul 2019 09:11 Edited at: 16th Jul 2019 09:12
This post has been marked by the post author as the answer.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Jul 2019 09:15
That's because it is processing both parts, i.e. on and off, so the torch_on variable is always 0.

You need to 'de-bounce' the key press detection.
Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 16th Jul 2019 09:44
Smallg and Amenmoses thanks for the help.
The script work perfectly.



Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-12-22 14:52:53
Your offset time is: 2024-12-22 14:52:53