Scripts / Press "E" to Switch hud on/off

Author
Message
ShN33Ky
Game Guru Backer
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: San Clemente ca.
Posted: 4th Oct 2016 00:25 Edited at: 4th Oct 2016 00:28
Using this entity based physics-active script at the moment for my hud but would like it to simply switch between 2 images by pressing "E" at anytime....get player distance not needed! Just 2 images like reading a note but whenever player chooses to!



appreciate any help....
Processor: Intel(R) i7-4700MQ CPU @ 2.40GHz 2.40 GHz Installed memory (RAM): 16.0 GB (15.8 GB usable) System type: 64-bit Operating System,x64-based processor

Start the day by righting your wrongs then end you day right so you don't have to do it again tomorrow ...

sHn33Ky
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 5th Oct 2016 14:07
Here's a link to a video I did on this. The script is also there.
https://forum.game-guru.com/thread/216400
I use the tilde key in this demo, but no problem to change that to any key you want.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
ShN33Ky
Game Guru Backer
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: San Clemente ca.
Posted: 6th Oct 2016 21:22
Thanks DVader......
Processor: Intel(R) i7-4700MQ CPU @ 2.40GHz 2.40 GHz Installed memory (RAM): 16.0 GB (15.8 GB usable) System type: 64-bit Operating System,x64-based processor

Start the day by righting your wrongs then end you day right so you don't have to do it again tomorrow ...

sHn33Ky
ShN33Ky
Game Guru Backer
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: San Clemente ca.
Posted: 24th Oct 2016 19:23
After watching Dvaders tutorial I was able to wright this nice little script using the "F" key to switch Hud images but I must Hold the "F" key down to view the 2nd image! When I release the "F" key it automatically returns to the 1st image! How can I make it Lock onto that image until the key is pressed again

Processor: Intel(R) i7-4700MQ CPU @ 2.40GHz 2.40 GHz Installed memory (RAM): 16.0 GB (15.8 GB usable) System type: 64-bit Operating System,x64-based processor

Start the day by righting your wrongs then end you day right so you don't have to do it again tomorrow ...

sHn33Ky
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Oct 2016 19:38
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 24th Oct 2016 19:45 Edited at: 24th Oct 2016 19:46
This is the template I use to write scripts which use keys to toggle something:



This one is for the J key, here's a picture of the keyboard scan codes, if you want to change it.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Attachments

Login to view attachments
ShN33Ky
Game Guru Backer
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: San Clemente ca.
Posted: 24th Oct 2016 20:37
Thanks Belidos & smallg.....@ smallg!

I'm sure it's my limited knowledge of LUA but your code is not working ! 1 my end's and if's do not appear blue in my editor which I have shuffled around to fix and 2 when you say "image_number" should be using "ShowImage (0) or just the Image # as it's self?? there are only 2 images I am trying to shuffle between 000 & 001....
Processor: Intel(R) i7-4700MQ CPU @ 2.40GHz 2.40 GHz Installed memory (RAM): 16.0 GB (15.8 GB usable) System type: 64-bit Operating System,x64-based processor

Start the day by righting your wrongs then end you day right so you don't have to do it again tomorrow ...

sHn33Ky
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Oct 2016 23:33
it's a variable like a counter so don't need to change it.
keep max images as 1 and it should already cycle through 2 pictures (as slot 0 is used as your first slot)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
ShN33Ky
Game Guru Backer
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: San Clemente ca.
Posted: 25th Oct 2016 01:00
Just not working for me.....unexpected char at line 194 error!!!......
Processor: Intel(R) i7-4700MQ CPU @ 2.40GHz 2.40 GHz Installed memory (RAM): 16.0 GB (15.8 GB usable) System type: 64-bit Operating System,x64-based processor

Start the day by righting your wrongs then end you day right so you don't have to do it again tomorrow ...

sHn33Ky
ShN33Ky
Game Guru Backer
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: San Clemente ca.
Posted: 26th Oct 2016 00:16
@ smallg!......I got your code to work! I don't know why but I'm finding cut & paste is not working in my lua editor! So I basically started from scratch with your code .Thank you smallg....there is a flicker perhaps a time delay function mite help if you know of any please let me know! But thanks Dude!
Processor: Intel(R) i7-4700MQ CPU @ 2.40GHz 2.40 GHz Installed memory (RAM): 16.0 GB (15.8 GB usable) System type: 64-bit Operating System,x64-based processor

Start the day by righting your wrongs then end you day right so you don't have to do it again tomorrow ...

sHn33Ky

Login to post a reply

Server time is: 2024-12-22 23:46:14
Your offset time is: 2024-12-22 23:46:14