Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-27-2011, 10:56 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
onKeyDown() and keydown(i) in GUIControls

I'm modifying my inventory to work with the keyboard, but I'm running into some problems
Why doesn't this work?
PHP Code:
function onMenuKeyDown() {
   
player.chat="MenuKeyDown";
   if (
keydown(8)) {
     
player.chat="TAB";
     
Inventory_Categories.forceonaction();
  }

The player only chats "MenuKeyDown".

So I'm doing this instead,which works, but can I even use keycodes? Aren't they platform specific?
PHP Code:
function onMenuKeyDown(gui,keycode) {
   
player.chat="MenuKeyDown";
   if (
keycode==9) {
     
player.chat="TAB";
     
Inventory_Categories.forceonaction();
  }

Reply With Quote
  #2  
Old 03-27-2011, 10:59 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Fulg0reSama View Post
Just a silly guess

PHP Code:
function onMenuKeyDown(gui,keycode) {
   
player.chat="MenuKeyDown";
}
   if (
keycode==9) {
     
player.chat="TAB";
     
Inventory_Categories.forceonaction();
  }

You forgot a bracket I believe.
Reply With Quote
  #3  
Old 03-27-2011, 11:03 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Crow View Post
Yeah, I didn't see GUIControls in the title...

Just forget I said anything.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #4  
Old 03-27-2011, 11:07 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
wild guess

GraalControl GUI (Which Graal is...) only has the keydown features. You're doing your system wrong if you need to do something like that. Can't you use this:

HTML Code:
function onKeyPressed() {
  if (keydown(0)) this.s_pos = max(0, this.s_pos- 10);
  if (keydown(1)) this.s_pos = max(0, this.s_pos - 1);
  if (keydown(2)) this.s_pos = max(0, this.s_pos + 10);
  if (keydown(3)) this.s_pos = max(0, this.s_pos + 1);
}
Would work I suppose if you had 10 items displayed on each row. Think about it?
__________________
Reply With Quote
  #5  
Old 03-27-2011, 11:10 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
Quote:
Originally Posted by xAndrewx View Post
wild guess

GraalControl GUI (Which Graal is...) only has the keydown features.
It really seems that way. The moment GraalControl isn't the first Responder, keydown() doesn't work.

So can I use keycodes or scancodes for special keys like TAB or SPACE? Will they be the same for Windows, Linux and Mac?
Reply With Quote
  #6  
Old 03-27-2011, 11:11 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by AlexanderK View Post
It really seems that way. The moment GraalControl isn't the first Responder, keydown() doesn't work.

So can I use keycodes or scancodes for special keys like TAB or SPACE? Will they be the same for Windows, Linux and Mac?
I don't think so. Refer to origional post
__________________
Reply With Quote
  #7  
Old 03-27-2011, 11:27 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Script help for 'key*global':

Clientside:
keydown2global(int, bool) - returns boolean
keydownglobal(int) - returns boolean

Script help for 'mouse*global':
Clientside:
leftmousebuttonglobal - boolean (read only)
middlemousebuttonglobal - boolean (read only)
mousebuttonsglobal - integer (read only)
rightmousebuttonglobal - boolean (read only)
__________________
Quote:
Reply With Quote
  #8  
Old 03-27-2011, 11:30 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
Quote:
Originally Posted by fowlplay4 View Post
Script help for 'key*global':

Clientside:
keydown2global(int, bool) - returns boolean
keydownglobal(int) - returns boolean

Script help for 'mouse*global':
Clientside:
leftmousebuttonglobal - boolean (read only)
middlemousebuttonglobal - boolean (read only)
mousebuttonsglobal - integer (read only)
rightmousebuttonglobal - boolean (read only)
I love you right now.
Reply With Quote
  #9  
Old 03-27-2011, 11:30 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
oh cooool
__________________
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 10:36 AM.


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