Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

FC, this tool is amazing!

Is there a way to have it so both Keyboard and Gamepad controls can work with this script?

As it is set up now, the variables for the controls are simply set to key constants and and Ord function. Which is connected to keyboard checks.

A gamepad button check works a bit differently as it also needs the controller device. So it basically needs two variables instead of one. Simply have, say, interact_key = gp_face2 will make the game crash if a gamepad is no connected. So changing the script works for either Keyboard or Gamepad, but not both.

I've been trying to mess around with the code to find the best possible solution. Is there something that can be done here?

Cheers

I know this is probably 2 years too late, but I recently discovered this dialogue engine and wanted to do the exact same thing - and after some messing around I've managed to come up with a solution! If it's of any benefit to you (or anyone else) I can explain how I did it?

Never a thing such as too late! I hope :)

Would love to hear your solution

No problem :)

Firstly I have a simple script for collecting inputs - it covers all the standard gamepad inputs etc. but for this the only ones that matter are :

scr_getinput()

KeyUp = keyboard_check_pressed(vk_up)or gamepad_axis_value(0, gp_axislv) < -0.40;

KeyDown = keyboard_check_pressed(vk_down)or gamepad_axis_value(0, gp_axislv) >  0.40;

KeySQButton = gamepad_button_check_pressed(0, gp_face3) or keyboard_check_pressed(ord('Z'));


Next I changed the create event for obj_textbox and par_speaker as follows:

obj_textbox (create)

if(instance_number(obj_textevent)>1 or instance_number(obj_textbox)>1){ instance_destroy(); exit; }

scr_getinput();

//-----------Customise (FOR USER)

interact_key        = false;       

up_key              = KeyUp;        //for dialogue choices

down_key            = KeyDown;      //for dialogue choices

par_speaker (create)

//-----------Customise (FOR USER)

scr_getinput();

playerobject = obj_player;

interact_key = false;


Then I altered the step events like so - I added this at the beginning:

scr_getinput();

if (KeySQButton !=0)

    interact_key = true;

else

    interact_key = false;


Then I changed each instance of "keyboard_check_pressed(interact_key)" to "interact_key == true" and replaced "var change_choice = keyboard_check_pressed(down_key) - keyboard_check_pressed(up_key);" with "var change_choice = KeyDown - KeyUp;"


There are probably better ways of doing it - but it works! :)

This is amazing. The devs should pin this to their FAQ or something. Great work and thank you