Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 08-22-2009, 01:04 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
What're you trying to do? If you're wanting for it to operate with Graals origional keys (those that you can change using the 'F3/Change Keys' option) you'll need to use keydown(variable).

Here's a couple of examples to show this
HTML Code:
function onKeyPressed() {
  temp.dirs = {"Up", "Left", "Down", "Right"};
  for (temp.dir = 0; temp.dir < 4; temp.dir++) {
    if (keydown(temp.dir)) {
      player.chat = "Pressed" @ temp.dirs[temp.dir];
    }
  }
}
HTML Code:
function onKeyPressed() {
  if (keydown(0)) player.chat = "Moving up";
  elseif (keydown(1)) player.chat = "Moving left";
  elseif (keydown(2)) player.chat = "Moving down";
  elseif (keydown(3)) player.chat = "Moving right";
}
Here are the keydown variables:
0, 1, 2 & 3 are all movement keys
4 is 'A'
5 is 'S'
6 is 'D'
7 is the map key [default- 'M']
8 is the tab key (chat toggle)
9 is the inventory [default- 'Q']
10 is for pausing [default- 'P']

Hope this helps.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.