Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Key Shortcuts?

is there any way that you can have certain keys on your keybord take you to a another passge?
for example:you press i to open the inventory,or c for a crafting menu.

Comments

  • I vaguely remember reading about a macro that did this in Sugarcane about a year ago... I'll wrack my brain and see if I can remember where... It might have just been someone else asking the same question, or talking about making their own script for it...
  • Hey,

    I have made a macro that allows you to press a key to go to a defined passage.
    But it doesn't seem to work when you put several macros on the same page. (The last one will only be considered)

    The macro is : <<keycontrol "KeyInUppercase" "Passage Title">>
    ie: <<keycontrol "C" "CRAFT">>

    The code :
    (function()
    {
    var keyToPress;
    var passageToGo;
    var keyPressed;

    function Init(params)
    {
    keyToPress = params[0];
    passageToGo = params[1];

    keyToPress = keyToPress.charCodeAt(0);
    }

    function KeyCheck(e)
    {
    if(!e) var e = window.event;
    if(e)
    {
    keyPressed = e.keyCode;
    }

    if(keyPressed == keyToPress)
    {
    state.display(passageToGo);
    }
    }

    document.onkeydown=function(){KeyCheck()};

    macros['keycontrol'] =
    {
    handler: function(container, macro, params)
    {
    init:Init(params);
    }
    }
    }());
  • so do i put that code in a script passge?
  • Would you mind to explain it a little more ? Where the code goes ? Should I be edit anything inside of it ?
    What should I do with the macro?

    (I'm terribly sorry, I'm new to both programming and Twine)
  • arsludus wrote:

    Would you mind to explain it a little more ? Where the code goes ? Should I be edit anything inside of it ?
    What should I do with the macro?

    (I'm terribly sorry, I'm new to both programming and Twine)


    1) right click and create a SCRIPT PASSAGE.

    2) copy and paste the code into the script passage.(not the script passge)


    3) put the macro in a passge.

    The macro is : <<keycontrol "KeyInUppercase" "Passage Title">>
    ie: <<keycontrol "C" "CRAFT">>

    thats all i know.
  • truly greatful!
Sign In or Register to comment.