unique kantilope Posted December 6, 2015 Share Posted December 6, 2015 alrighty, so im working on my first character and i want to have a toggle-mode that is controlled by a key press (z by default). i've been repurposing alot of code from other mods and thats been going fine, but i was only able to find an example of using a key-press as a trigger from a DST mod, and the character im working on is for DS. the character works fine when i comment out the following lines in the modmain: GLOBAL.TheInput:AddKeyDownHandler(GetModConfigData("key_burned"), function() --triggered if character == "amonon" and GetPlayer().IsBurning==true then NormalStats(inst) elseif character == "amonon" then TurnBurning(inst) endend) i can also just comment out the first and last lines thereof. so i at least know where the problem comes from. i think. however, when i try to just run the whole thing, the game crashes on attempt to implement the mod, and i get this: http://i.imgur.com/bAszv0r.png Link to comment Share on other sites More sharing options...
Arkathorn Posted December 6, 2015 Share Posted December 6, 2015 Perhaps "key_burned" is not a defined key? Link to comment Share on other sites More sharing options...
unique kantilope Posted December 6, 2015 Author Share Posted December 6, 2015 sorry should've mentioned, i have a config that sets "key_burned" in the modinfo, which by all accounts appears to be running fine. but if there were a way to directly replace: GetModConfigData("key_burned") with just "Z" or 122 or something so that i could test it, that would be lovely. but i don't know exactly how, though i have tried. Link to comment Share on other sites More sharing options...
pickleplayer Posted December 6, 2015 Share Posted December 6, 2015 Try KEY_Z Link to comment Share on other sites More sharing options...
unique kantilope Posted December 7, 2015 Author Share Posted December 7, 2015 no dicesame exact crash message when using: GetModConfigData("key_burned") KEY_Z Z no error message, but nothing happens when z is pressed in-game: 122 "Z" good news everyone! the solution was to use GLOBAL.KEY_Zunfortunately that means i cant use the config for the moment but ill cross that bridge when i give a damn. Link to comment Share on other sites More sharing options...
Kzisor Posted December 8, 2015 Share Posted December 8, 2015 good news everyone! the solution was to use GLOBAL.KEY_Zunfortunately that means i cant use the config for the moment but ill cross that bridge when i give a damn. When getting mod configuration settings its good practice to create a local variable for setting usage with an 'or' statement because mod configuration settings could return 'nil'.local key = GetModConfigData("key_burned") or GLOBAL.KEY_ZGLOBAL.TheInput:AddKeyDownHandler(key, function() --triggered if character == "amonon" and GetPlayer().IsBurning==true then NormalStats(inst) elseif character == "amonon" then TurnBurning(inst) endend) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.