Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 08-21-2009, 07:42 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by DustyPorViva View Post
PHP Code:
function onKeyPressed() {
  if (
keydown(0-3)) {
    
player.chat "arrow key pressed";
  }

keydown(int) can be used along with onKeyPressed() to detect default key configurations.

That's a bit vague for someone that might not be familiar with loops since they wouldn't realize that they would benefit from using one in this case:

PHP Code:
function onKeyPressed() {
  for (
temp.key 0temp.key 4temp.key++) {
    if (
keydown(key)) {
      
player.chat "directional key pressed";
    }
  }


Stuff like this has been posted before, possibly in multiple threads, people should really use the search function, they would get answers to their questions much faster.


EDIT: It's probably better to say 'directional key pressed' instead of 'arrow key pressed' since that would imply that the script would only trigger when you press an arrow key, when in fact it would trigger whenever you pressed any of the directional keys that you have set in your F3 options.

Last edited by Gambet; 08-21-2009 at 08:02 PM..
Reply With Quote
 


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.