Any script to change the controls in running game?

You must understand the Game Editor concepts, before post here.

Any script to change the controls in running game?

Postby tvz » Sun Mar 24, 2013 4:23 pm

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 :(
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

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

Postby skydereign » Sun Mar 24, 2013 6:05 pm

There is a function to do that called remapKey. You can read about it here. http://game-editor.com/docs/script_reference.htm
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

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

Postby tvz » Mon Mar 25, 2013 4:29 pm

thankyou so much.
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

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

Postby tvz » Tue Mar 26, 2013 2:45 pm

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 :?
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

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

Postby skydereign » Wed Mar 27, 2013 8:23 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

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

Postby tvz » Wed Mar 27, 2013 3:02 pm

I made a demo in which is used a variable 'selectedkey' to set the key. Please help me by improving it
Attachments
Key config.zip
Please help by improving
(50.54 KiB) Downloaded 137 times
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

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

Postby skydereign » Wed Mar 27, 2013 8:15 pm

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).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

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

Postby tvz » Thu Mar 28, 2013 3:16 pm

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
Attachments
change key in running game.zip
(55.35 KiB) Downloaded 141 times
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest