Page 1 of 1

Any script to change the controls in running game?

PostPosted: Sun Mar 24, 2013 4:23 pm
by tvz
I am not a programmer but is anyone there who has written the script to change the controls while playing games. All of you must have played games in which we can change controls as we want. Please help me :(

Re: Any script to change the controls in running game?

PostPosted: Sun Mar 24, 2013 6:05 pm
by skydereign
There is a function to do that called remapKey. You can read about it here. http://game-editor.com/docs/script_reference.htm

Re: Any script to change the controls in running game?

PostPosted: Mon Mar 25, 2013 4:29 pm
by tvz
thankyou so much.

Re: Any script to change the controls in running game?

PostPosted: Tue Mar 26, 2013 2:45 pm
by tvz
the remapkey function worked but now both the the key, the one which i set to default and and second which is set by remapkey are working.
i want only configured key to work not the default one. please help :?

Re: Any script to change the controls in running game?

PostPosted: Wed Mar 27, 2013 8:23 am
by skydereign
This is happening because remapKey remaps the first key to be the second key. So, if you only use remapKey to change left to right, then both left and right will be the same as pressing right. Therefore, you should either swap the two (left becomes right, and right becomes left) or set the old key equal to some unused key.

Re: Any script to change the controls in running game?

PostPosted: Wed Mar 27, 2013 3:02 pm
by tvz
I made a demo in which is used a variable 'selectedkey' to set the key. Please help me by improving it

Re: Any script to change the controls in running game?

PostPosted: Wed Mar 27, 2013 8:15 pm
by skydereign
tvz wrote:Please help me by improving it

In what way? With the method you are using right now, there isn't really a need for the remapKey function, as you are just using a variable to hold the key values. That would work, if you don't actually use keydown events (and instead just use getKeyState).

Re: Any script to change the controls in running game?

PostPosted: Thu Mar 28, 2013 3:16 pm
by tvz
Sorry, i posted the wrong one the correct one is this there is no selectedkey variable. instead I used skey variable.
But what is wanted to know is clear. And this demo is good with no remapkey func.. and thanks for your help