Scripts / lua script help - switch(case)

Author
Message
gd
8
Years of Service
User Offline
Joined: 21st Jul 2016
Location: Small Darkroom with no red light
Posted: 25th Oct 2016 19:43 Edited at: 25th Oct 2016 19:45
Hi all, I just wanted to know if anybody has used the ( Switch, Case ) toggle system in lua yet.
The example would be; you have a few huds that you want to be able to switch between using the same key. Based on how many times you press the key it will turn on/off each function hud in-turn.

Example:

Key "H" turn compass off.
Key "H" turn night-vision off.
Key "H" turn map off.
Key "H" etc off.
Key "H" turn compass on.
Key "H" turn night-vision on.
and so on.

Any help would be great

Thanks guys
Dark Base 900 Pro OJ: Rampage V Ed.10, i7 6950x non-OC, DDR4-3333 64 GB RAM, Win 10/64, Asus Strix GeForce 1080 x 2 MDA mode, Water cooled with an old Victorian cast iron radiator and a industrial leather belt driven fan - That's what you call Steampunked.

Laptop - M17xR3
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Oct 2016 09:32
I've used the same letter before for two things when we had super limited input and basically had to use E for everything, but in my case I just checked between pressing E or holding E for a while.

The basic system would be to check a temporary variable along with the keypresses to see how many times the button is pressed in a certain time limit between presses then apply any action afterwards/when the button is not pressed again fast enough.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
gd
8
Years of Service
User Offline
Joined: 21st Jul 2016
Location: Small Darkroom with no red light
Posted: 27th Oct 2016 14:19
Thanks smallg, I will look into it
Dark Base 900 Pro OJ: Rampage V Ed.10, i7 6950x non-OC, DDR4-3333 64 GB RAM, Win 10/64, Asus Strix GeForce 1080 x 2 MDA mode, Water cooled with an old Victorian cast iron radiator and a industrial leather belt driven fan - That's what you call Steampunked.

Laptop - M17xR3
PM

Login to post a reply

Server time is: 2024-12-22 23:56:44
Your offset time is: 2024-12-22 23:56:44