How do I customize the keyboard?

From OHRRPGCE-Wiki

Jump to: navigation, search

There is no built-in feature to customize the keyboard in an OHRRPGCE game. The default controls are:


Arrow Keys Movement
Space or Enter or CTRL Use/Talk
ESC or ALT Menu/Cancel
Hold ESC Run (battle)

It is possible to set up your own keyboard controls using plotscripting. You must use the suspend player command to disable normal keyboard actions, and then create an On-Keypress script that uses the key is pressed command to check what key the player has pressed.

Here is an example script that re-implements the default controls. You can customize it to suit your own needs

This article does not meet the standard of quality we would like to have. Feel free to revise it and make it better by using the edit link at the top of the page. This tag should be removed when an editor feels it is of high quality.
include, plotscr.hsd
include, scancode.hsi

plotscript, keypress handler, begin

  variable (x,y,d)

  if (hero is walking(me) == false) then, begin

    if (key is pressed(Key:Up)) then (walk hero(me, up, 1))
    if (key is pressed(Key:Left)) then (walk hero(me, left, 1))
    if (key is pressed(Key:Down)) then (walk hero(me, down, 1))
    if (key is pressed(Key:Right)) then (walk hero(me, right, 1))

    if (key is pressed(Key:Space),or,key is pressed(Key:Enter),or,key is pressed(Key:CTRL)) then,begin
      x := hero X(me)
      y := hero Y(me)
      d := hero direction(me)
      if (d == up) then(decrement(y))
      if (d == left) then(decrement(x))
      if (d == down) then(increment(y))
      if (d == right) then(increment(x))
      use NPC(NPC at spot(x,y))
    end

    if (key is pressed(Key:ESC),or,key is pressed(Key:ALT)) then, begin
      # erk! this can't be done yet! :(
    end

  end

end

In typing this, I suddenly realized that although there are commands to call up each sub-menu, there is no command to call up the main menu... and I have no idea why! An enhacement request for this feature has been filed.

Personal tools