Scripts / Can't get this script to work

Author
Message
ZephaHD
8
Years of Service
User Offline
Joined: 19th Mar 2016
Playing:
Posted: 17th Feb 2017 20:20
Pretty sure this is the 1000th today I've posted on the forums, but as long as I'm not being a burden to anybody, that should be okay xD
Anyways, for learning purposes only, I decided to see if I can create a script that can display a message for 3 seconds saying whether the player flashlight is on or off depending on if the flashlight is on or off... I know, completely and utterly useless but as I said, learning purposes. So, this script crashes the game whenever I activate my flashlight, and I can't figure out why. Something to do with concatenating? I'm not sure how to add a code snippet just yet, so I'll have to be a pain and attach the script here. I'm just looking for ways to improve my LUA coding knowledge as I started today. Thanks for any help you may or may not give!
GTX 970 Strix, Intel I7 870 (4 cores) -2.9GHz, 16GB RAM, 1920x1080

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Feb 2017 20:31
pretty sure they should be elseif's all the way down and you didn't define flashlight2 as a string to start with
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
ZephaHD
8
Years of Service
User Offline
Joined: 19th Mar 2016
Playing:
Posted: 17th Feb 2017 20:35
Ah okay, thank you, I'll be sure to test this. Do you have any idea as to why my game was crashing when the flashlight was enabled though?
GTX 970 Strix, Intel I7 870 (4 cores) -2.9GHz, 16GB RAM, 1920x1080
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Feb 2017 20:42
the script was broken, not enough ends
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
ZephaHD
8
Years of Service
User Offline
Joined: 19th Mar 2016
Playing:
Posted: 17th Feb 2017 20:49
It works great! Thank you!
GTX 970 Strix, Intel I7 870 (4 cores) -2.9GHz, 16GB RAM, 1920x1080

Login to post a reply

Server time is: 2024-04-18 15:18:09
Your offset time is: 2024-04-18 15:18:09