Jump to content

How to add a new key/gamepad binding option


Fidooop

Recommended Posts

Like the title says... I'd like to either add this to the modinfo or to the game's controls menu...

 

what is it that I'm trying to make changeable? Wilford Warfstache's 'buff' key (which is currrently just the 'x' key) I want it so that users can use any available/not currently in use keys/gamepad buttons that they want to so that it is far more comfortable for them.

 

I will not be uploading the markiplier mod to this thread as it is rather large... so if you'd like to take a peek at my code so that you can better tell me how to do such a thing...

then head on over here to download it: http://forums.kleientertainment.com/topic/33451-markiplier-mod/

Link to comment
Share on other sites

  • Developer

Hey Fidooop, awesome work on the Markiplier mod! I haven't tried it myself yet, but I definitely enjoyed watching Markiplier play it!

Unfortunately we don't currently have support for adding new controls. This is definitely something we can look at adding in a future release though. I looked into it yesterday to see what alternatives there are for you currently and I've got 2 workarounds that you could try right now.

The first option would be to override an unused/less often used control input. To do this, the first thing you'll want to do is copy controlsscreen.lua to your mod's appropriate folder (your_mod_name\scripts\screens). Then find a control in your controlsscreen.lua that you feel that your mod could get away without having access to. In my test case I overrode CONTROL_ROTATE_LEFT (since technically you can just rotate to the right all the way around). Look up it's value in constants.lua (it should be 11) and replace it in the kbcontrols table and the controllercontrols table.

 

Then in your modmain file you'll want to do the following:

local actual_CONTROL_ROTATE_LEFT = GLOBAL.CONTROL_ROTATE_LEFTfunction YourFunction( control, down )	if control == actual_CONTROL_ROTATE_LEFT and down then		print("your code goes here!")	endendfunction gamepostinit()	print( "Redirecting user input" )	GLOBAL.CONTROL_ROTATE_LEFT = 99 --arbitrary unused control value	GLOBAL.TheInput:AddGeneralControlHandler( YourFunction )	GLOBAL.STRINGS.UI.CONTROLSSCREEN.CONTROLS[actual_CONTROL_ROTATE_LEFT+1] = "Your control name"endAddGamePostInit(gamepostinit)

Obviously this isn't ideal if you want to add a bunch of new controls, but if you just need a single control or two, you could also override the upper inventory control slots.

 

 

The second option would be to handle the input yourself and make it configurable via your mod's configuration page. To do this, add a key down handler in your modmain.lua.

function YourFunctionOnKey()	print("your code goes here!")endfunction gamepostinit()	GLOBAL.TheInput:AddKeyDownHandler( GetModConfigData("dmg_key"), YourFunctionOnKey )endAddGamePostInit(gamepostinit)

Then in your modinfo.lua file you'll want to setup some configuration options to allow the user to change the key you're going to listen to.

configuration_options ={    {        name = "your_key",        label = "Your Key",        options =         {            {description = "Z", data = 122}, --KEY_Z from constants.lua            {description = "X", data = 120}, --KEY_X from constants.lua            {description = "C", data = 99} --KEY_C from constants.lua            --add other keys you want to allow        },        default = 99,    },}

This second solution isn't quite as tidy since it will require a lot more setup yourself in your mod config options to allow mapping to mouse vs keyboard, so if you can get away with losing one or two shortcut buttons going with the first option would probably be easier.

Either way, I've made a note that custom configurable controls is something you would like added.

 

Let me know if you have any questions or if something doesn't work out for you.

Link to comment
Share on other sites

Hey Fidooop, awesome work on the Markiplier mod! I haven't tried it myself yet, but I definitely enjoyed watching Markiplier play it!

Unfortunately we don't currently have support for adding new controls. This is definitely something we can look at adding in a future release though. I looked into it yesterday to see what alternatives there are for you currently and I've got 2 workarounds that you could try right now.

The first option would be to override an unused/less often used control input. To do this, the first thing you'll want to do is copy controlsscreen.lua to your mod's appropriate folder (your_mod_name\scripts\screens). Then find a control in your controlsscreen.lua that you feel that your mod could get away without having access to. In my test case I overrode CONTROL_ROTATE_LEFT (since technically you can just rotate to the right all the way around). Look up it's value in constants.lua (it should be 11) and replace it in the kbcontrols table and the controllercontrols table.

 

Then in your modmain file you'll want to do the following:

local actual_CONTROL_ROTATE_LEFT = GLOBAL.CONTROL_ROTATE_LEFTfunction YourFunction( control, down )	if control == actual_CONTROL_ROTATE_LEFT and down then		print("your code goes here!")	endendfunction gamepostinit()	print( "Redirecting user input" )	GLOBAL.CONTROL_ROTATE_LEFT = 99 --arbitrary unused control value	GLOBAL.TheInput:AddGeneralControlHandler( YourFunction )	GLOBAL.STRINGS.UI.CONTROLSSCREEN.CONTROLS[actual_CONTROL_ROTATE_LEFT+1] = "Your control name"endAddGamePostInit(gamepostinit)

Obviously this isn't ideal if you want to add a bunch of new controls, but if you just need a single control or two, you could also override the upper inventory control slots.

 

 

The second option would be to handle the input yourself and make it configurable via your mod's configuration page. To do this, add a key down handler in your modmain.lua.

function YourFunctionOnKey()	print("your code goes here!")endfunction gamepostinit()	GLOBAL.TheInput:AddKeyDownHandler( GetModConfigData("dmg_key"), YourFunctionOnKey )endAddGamePostInit(gamepostinit)

Then in your modinfo.lua file you'll want to setup some configuration options to allow the user to change the key you're going to listen to.

configuration_options ={    {        name = "your_key",        label = "Your Key",        options =         {            {description = "Z", data = 122}, --KEY_Z from constants.lua            {description = "X", data = 120}, --KEY_X from constants.lua            {description = "C", data = 99} --KEY_C from constants.lua            --add other keys you want to allow        },        default = 99,    },}

This second solution isn't quite as tidy since it will require a lot more setup yourself in your mod config options to allow mapping to mouse vs keyboard, so if you can get away with losing one or two shortcut buttons going with the first option would probably be easier.

Either way, I've made a note that custom configurable controls is something you would like added.

 

Let me know if you have any questions or if something doesn't work out for you.

While I'm not a fan of Markiplier , Thanks Peter for jumping into the mod forums to help out with support. 

Link to comment
Share on other sites

Is there some universal  'what was just pressed'  detection?   It would be much more convenient if a user could be told  "press the key you want"  and whether they press the 'U' on the keyboard,  the  'button 5'  on their mouse or  the  'right trigger' on their game pad it will return an object representing this press event.

 

Really what would be most useful is this generalized event detection so a player could just press the key, instead of finding it in a config menu that lists every single thing imaginable.

 

Id imagine this similar to the OnRawKey event that already exists in the Widget class except it would include a deviceID as an argument

Link to comment
Share on other sites

  • Developer

Is there some universal  'what was just pressed'  detection?   It would be much more convenient if a user could be told  "press the key you want"  and whether they press the 'U' on the keyboard,  the  'button 5'  on their mouse or  the  'right trigger' on their game pad it will return an object representing this press event.

 

Really what would be most useful is this generalized event detection so a player could just press the key, instead of finding it in a config menu that lists every single thing imaginable.

 

Id imagine this similar to the OnRawKey event that already exists in the Widget class except it would include a deviceID as an argument

 

I don't believe there is a universal "what was just pressed" detection available to you on the lua side, as largely the input logic is handled on the code side (that's how controlsscreen.lua currently works). You could probably piece together something with GLOBAL.TheInput:AddKeyHandler and AddMouseButtonHandler, but I'm not sure how robust that would be. I think the best option for everyone would be for custom configurable controls to be added so that the mods can add new controls and have it function just like the built in controls.

Link to comment
Share on other sites

I think the best option for everyone would be for custom configurable controls to be added so that the mods can add new controls and have it function just like the built in controls.

I'd love that very much so! thankyou for taking the time to help me out with this! I'm going to go with your first workaround until things change.

I'll let you know if the first workaround gives me any troubles while trying to use it ;)

Link to comment
Share on other sites

@PeterA yaaay! I managed to replace a button and then recode the button in the modmain!!

local ConsoleUp = falselocal ConsoleScreen = require "screens/consolescreen"GLOBAL.TheInput:AddKeyDownHandler(96, function()    if ConsoleUp == false then        GLOBAL.TheFrontEnd:PushScreen(ConsoleScreen())        ConsoleUp = true    elseif ConsoleUp == true then        GLOBAL.TheFrontEnd:PopScreen()        GLOBAL.SetPause(false)        ConsoleUp = false    endend)local actual_CONTROL_OPEN_DEBUG_CONSOLE = GLOBAL.CONTROL_OPEN_DEBUG_CONSOLElocal actual_CONTROL_OPEN_DEBUG_MENU = GLOBAL.CONTROL_OPEN_DEBUG_MENUfunction BuffWilford( control, down )    if down == true then        if control == actual_CONTROL_OPEN_DEBUG_CONSOLE or control == actual_CONTROL_OPEN_DEBUG_MENU then            if GetPlayer() and GetPlayer().prefab == "wilford" and GetPlayer().components.stache then                GetPlayer():SwitchPowers(GetPlayer())            end        end    endendfunction gamepostinit()    GLOBAL.CONTROL_OPEN_DEBUG_CONSOLE = 99    GLOBAL.CONTROL_OPEN_DEBUG_MENU = 99    GLOBAL.TheInput:AddGeneralControlHandler( BuffWilford )    GLOBAL.STRINGS.UI.CONTROLSSCREEN.CONTROLS[actual_CONTROL_OPEN_DEBUG_CONSOLE+1] = "Wilford Buff"    GLOBAL.STRINGS.UI.CONTROLSSCREEN.CONTROLS[actual_CONTROL_OPEN_DEBUG_MENU+1] = "Wilford Buff"endAddGamePostInit(gamepostinit)

This'll do exactly what I need it to do until Don't Starve updates with custom mod configurable button options :-)

Link to comment
Share on other sites

@Fidooop Actually, you just said you were adding Warfstache.  You didn't tell me you were using all of the features I gave him.  You said that you wanted to see his lines more often.

I specifically told you that he'd have a custom badge that was activatable... it is VERY different from your sprint meter in many ways! yours regens over time while mine requires you to eat meats and kill things and it drains overtime... yours requires the player to hold the key down while mine you just press the button to turn it on/off! yours only makes wilford sprint while mine only makes wilford rip his shirt off and deal double damage...

 

ALSO mine has a cooldown on it and you can't use it if your meter is under 100!

When coming up with my badge and ability I was not thinking of your sprint meter at all in any way possible!

your sprint meter is still VERY original compared to my warfstache badge :-)

 

other differences are my wilford has a penalty whenever eating any plants and when he is buffed he becomes a full on carnivore until he goes back!

your wilford has tiny box tim my wilford has a warfstaff, warf-flowers, warf-bugs, the poofgun, and warfmuffins!

I'm not going to make a character without going all out and making something original about them... if you disagree it's your problem for accepting me releasing him! I explained all of his features before ever releasing him in the update and you said yes that's fine. I guess you just didnt read it all or misunderstood something

 

I swear to you that my Wilford is FAR different from your Wilford in so very many ways possible!

playing as my wilford completely changes the gameplay since you're going to be wanting meat more than plants and you'll be farming a whole new material aswell!

I'm deeply sorry if it looks at all like a duplicate of your mod but I assure you that it MOST DEFINITELY is not at all...

 

I'm done overexplaining myself now! :grin:

Link to comment
Share on other sites

Two things I'd like to point out:

 

1. You didn't explain his features, you just said you wanted to see his lines more often.  My point is not quite that you are implementing the exact same features, my point is that you are using my CONCEPTS.  Whenever I talk about a new idea, you come out with an idea that's quite similar, but just different enough so you can say you're not copying.

 

2. Just the fact that you knew EXACTLY that I was talking about the sprint meter makes me think otherwise...

 

When you talked to me on Steam, you asked "can I add Warfstache?"  You had already implemented him, so I didn't care.  You didn't give me more info than that (aside from "I just want to see his lines more often").  You didn't tell me you wanted to implement concepts that were very similar to mine, the discussion was about a Warfstache character as an object, a "custom story" for Warfstache, and Slenderman.  That's it.  PLEASE stop trying to one-up me every time I try to do something that makes my mod unique.  Just because your mod is more well-known than mine does not give you permission to mooch off of mine.  I don't want to compete with you, I just want both mods to get the respect that they deserve.  I'd just like to point out that many other people have brought to my attention the striking resemblance between the mods.  Unfortunately, people have been calling ME a copycat for stuff like this because your mod was the one Markiplier got to first.  Surely you would agree that this means that they must have similar features?

Link to comment
Share on other sites

Two things I'd like to point out:

 

1. You didn't explain his features, you just said you wanted to see his lines more often.  My point is not quite that you are implementing the exact same features, my point is that you are using my CONCEPTS.  Whenever I talk about a new idea, you come out with an idea that's quite similar, but just different enough so you can say you're not copying.

 

2. Just the fact that you knew EXACTLY that I was talking about the sprint meter makes me think otherwise...

 

When you talked to me on Steam, you asked "can I add Warfstache?"  You had already implemented him, so I didn't care.  You didn't give me more info than that (aside from "I just want to see his lines more often").  You didn't tell me you wanted to implement concepts that were very similar to mine, the discussion was about a Warfstache character as an object, a "custom story" for Warfstache, and Slenderman.  That's it.  PLEASE stop trying to one-up me every time I try to do something that makes my mod unique.  Just because your mod is more well-known than mine does not give you permission to mooch off of mine.  I don't want to compete with you, I just want both mods to get the respect that they deserve.  I'd just like to point out that many other people have brought to my attention the striking resemblance between the mods.  Unfortunately, people have been calling ME a copycat for stuff like this because your mod was the one Markiplier got to first.  Surely you would agree that this means that they must have similar features?

I'd rather this conversation continue in private if you so choose you want to talk about it even more...

 

I played your mod after I implemented my Wilford to make sure that I wasn't copying anything too much and I survived for a good 50 days with your wilford and I assure you that your wilford is still very original and different compared to mine! I hate it when people call you a copy cat because I definitely know you are not!

 

answer to your first point... YES! I did want to see my wilford's lines more often! but I wasn't going to make some cheap character with nothing special about them... they'd be more generic than wilson at that point! I wanted a game changer character so this is what I went with...

 

My wilford originally was going to be a repeat of wolfgang but I hated the way the experience was since it was exactly like wolfgang, the fact that it was copying a klei character on the dot, and the fact that it'd need 4 atlases so I made up something that was in my opinion original! I threw in a custom badge that regens when Wilford does badass things like eat meat or kill something and the badge can be activated whenever the player wants to be buffed (hit harder, regen sanity and health, loose alot of hunger, look sexy, etc.) rather than whenever the player has filled their stomach

 

I had NO intentions in copying your sprint meter at all in anyway possible nor had I remembered it even existed until a couple weeks after I had implemented my badge...

 

secondly I did explain that my features has some similarities with yours because I looked at your mod description while talking to you and noticed the sprint badge was there and your wilford liked meat... but you probably did not see alot of what I was telling you as you seemed very AFK half the time I was messaging you!

 

I really do not want this to turn into a flame war I just want to get the point across to you that neither of us are copying each other in any way shape or form at all... anything that ends up having something similar is mere coincidence since we are both making the same person into different mods for the same game...

 

I do not want to be in competition with you just as much as you don't want to be in competition with me...

in fact I WANT to see Mark play your mod! I have nothing against you and I do not want to steal from you!

so what do you say? we cool?

Link to comment
Share on other sites

Buff keys have been around since the Atari 2600 days of gaming. Sorry but that idea is not unique so stop whining someone is borrowing a concept. Neither of you own the concept of markiplier so you have no grounds to whine there. When you're both using concepts from 30 years of gaming and basing on a current public figure and his characters you will have overlap.

Link to comment
Share on other sites

@seronis I don't believe you have enough information to jump in on this argument.  It has been a source of conflict since the beginning of each mod.  Also, my problem is not that he is adding a buff key.  If you read the comment, you would know that my problem is the convenient timing of his announcements RIGHT AFTER my extraordinarily similar ones.

Link to comment
Share on other sites

@JackSlender I have to agree with @seronis because we both (including myself) are just being little babies about this whole thing we should just stop...

 

(also seronis I meant original for a don't starve mod... I know LOTS of games have buff buttons but nobody has done a buff button for a don't starve mod yet xD............. atleast from what I've seen....)

Link to comment
Share on other sites

@Fidooop and @JackSlender, having had my ideas copied before, I can easily see this is a tricky situation.  Firstly, I have been watching both mods since the beginning, and I can say that there seem to be striking similarities between some of the things in each.  Naturally, I can see where JackSlender is coming from, and I can understand why you're losing patience with this.  It may be worth announcing some of your stuff now and then agreeing not to have any similarities between the two.  I think you've both mentioned Slender Man at this point, so it may be important to distinguish the similar things.  You might want your ideas to remain private though, so I can't fault you for that.  I understand that neither of you have and bad intents, but situations like this can easily get out of hand, so I advise caution when handling this.  Try to see things from each others point of view. 

 

Idea: One idea may be to try and embrace different sides of Markiplier.  I've heard a lot of people talk about how Fidooop's is more of "crazy insane Mark", so maybe JackSlender should focus on "thoughtful atmospheric Mark"?  Just throwing ideas out there. . .

Link to comment
Share on other sites

Like the title says... I'd like to either add this to the modinfo or to the game's controls menu...

 

what is it that I'm trying to make changeable? Wilford Warfstache's 'buff' key (which is currrently just the 'x' key) I want it so that users can use any available/not currently in use keys/gamepad buttons that they want to so that it is far more comfortable for them.

 

I will not be uploading the markiplier mod to this thread as it is rather large... so if you'd like to take a peek at my code so that you can better tell me how to do such a thing...

then head on over here to download it: http://forums.kleientertainment.com/topic/33451-markiplier-mod/

 

Markiplier mod should be called "Warkiplier" since all the characters start with a W

Link to comment
Share on other sites

... it is definitely more of an issue than petty squabbling....

Nope. Its petty squabling. Any complaint that 'he stole my idea' is the very definition of petty. Ideas are like math formulas. They just exist and no one owns them. Now IMPLIMENT the idea better or someone else will. WHoever does the better job (based on what a given player wants) will get the player.

And guess what? Different players want different things. So the subtlties of the differences between the two mods will be what determines who wants one and who wants the other. They are not completing. They are either meeting the desires of a person using the mod or they are not.

Write the mod so that YOU ENJOY PLAYING IT YOURSELF. Stop caring if anyone else does something similar EVEN if its 99% similar. That 1% can be the deal breaker for a player and you just made that players day.

Now stop the petty whining and move on. And both the mods are great even if I otherwise think idolizing youtubers is stupid.

Link to comment
Share on other sites

Nope. Its petty squabling. Any complaint that 'he stole my idea' is the very definition of petty. Ideas are like math formulas. They just exist and no one owns them. Now IMPLIMENT the idea better or someone else will. WHoever does the better job (based on what a given player wants) will get the player.

And guess what? Different players want different things. So the subtlties of the differences between the two mods will be what determines who wants one and who wants the other. They are not completing. They are either meeting the desires of a person using the mod or they are not.

Write the mod so that YOU ENJOY PLAYING IT YOURSELF. Stop caring if anyone else does something similar EVEN if its 99% similar. That 1% can be the deal breaker for a player and you just made that players day.

Now stop the petty whining and move on. And both the mods are great even if I otherwise think idolizing youtubers is stupid.

 

Depends on what kind of idea's my friend!

Link to comment
Share on other sites

Nope. Its petty squabling. Any complaint that 'he stole my idea' is the very definition of petty. Ideas are like math formulas. They just exist and no one owns them. Now IMPLIMENT the idea better or someone else will. WHoever does the better job (based on what a given player wants) will get the player.

 

I understand you're trying to diffuse the arguement, but insisting that people are squabling and talking about people "getting the player"s may just enflame the arguement.  Once again, when people are working on similar projects, tensions may be high (especially since one is a one person team while the other has tons of contributers).  That being said, I think both mods (while having some very similar ideas) have very unique executions.  I look forward to seeing what you both have to offer, and perhaps you should both make your ideas crystal clear as to avoid futher conflicts.  You may even want to start a new thread talking about what you're planning on adding (just to be sure that any similar ideas you have will continue to have unique executions).

 

As a final note: I declare this thread to have been officially derailed.  What say we leave this talk to another place, hm?

Link to comment
Share on other sites

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.

×
  • Create New...