Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-18-2002, 11:13 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
arrow keys

Stefan, why don't you add keycodes for the arrow keys. Because the keydowns(0..3) just check for the specified key (so if they change it to j,k,l,o, then it will check those if i use keydown(0..3)
Reply With Quote
  #2  
Old 10-19-2002, 12:05 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
I doubt Stefan added the keycodes...they are those used by the BIOS/Windows. Just look in some table for the keycodes for the arrow keys.
Here, I found those in the header file of a DOS game programming library (Allegro):
NPC Code:

#define KEY_LEFT 82
#define KEY_RIGHT 83
#define KEY_UP 84
#define KEY_DOWN 85


I didn't test them though.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #3  
Old 10-20-2002, 04:09 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Ok, they were wrong. I needed to write a windows program to get the right ones. Here they are:
up - 38
left - 37
down - 40
right - 39
Graal isn't triggering a keypressed event though. You need to check it in timeouts.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #4  
Old 10-20-2002, 06:56 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
that isnt standard ASCII code though, so it wouldnt do anything with keydown2
Reply With Quote
  #5  
Old 10-20-2002, 08:34 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
I've had arrow keys work with keydown2 before.
__________________
Reply With Quote
  #6  
Old 10-20-2002, 09:44 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
bah :P never worked for me
Reply With Quote
  #7  
Old 10-20-2002, 07:53 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Quote:
Originally posted by R0bin
that isnt standard ASCII code though, so it wouldnt do anything with keydown2
Huh? Something like this worked for me:
NPC Code:

if (playerenters) {
timeout = 0.05;
}
if (timeout) {
if (keydown2(38,true)) message Up;
if (keydown2(37,true)) message Left;
if (keydown2(40,true)) message Down;
if (keydown2(39,true)) message Right;
timeout = 0.05;
}

__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #8  
Old 10-21-2002, 12:18 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by Kaimetsu
I've had arrow keys work with keydown2 before.
along with keypressed, though?
__________________

Reply With Quote
  #9  
Old 10-21-2002, 09:00 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by CheeToS2


along with keypressed, though?
Maybe. Maybe not. Does it matter?
__________________
Reply With Quote
  #10  
Old 10-21-2002, 05:31 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by Kaimetsu


Maybe. Maybe not. Does it matter?
yes, it does, since that is part of the point of this thread! (in regards to Com's post)
__________________

Reply With Quote
  #11  
Old 10-21-2002, 06:39 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by R0bin
that isnt standard ASCII code though, so it wouldnt do anything with keydown2
We are talking about keycodes here, which is keyboard input as far as I know. ASCII is something with fonts or whatever.
Reply With Quote
  #12  
Old 10-21-2002, 09:38 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by CheeToS2


yes, it does, since that is part of the point of this thread! (in regards to Com's post)
But there's nothing you can do with keypressed that you can't do with keydown2 and a timeout loop.
__________________
Reply With Quote
  #13  
Old 10-22-2002, 12:13 AM
Jeff Jeff is offline
Registered User
Join Date: Oct 2002
Location: Nebraska, USA
Posts: 707
Jeff is on a distinguished road
Kai:

That is true, however, as I understand it keypressed is far more efficient.
__________________
Jeff, the Archduke of Dustari
Member of the LAT on Graal The Adventure
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GO d+ s++:+ !a C++ UL+(UL+++)@ P+ L+(++)>+++ E---- W++@ N- !o ?K w(w--) !O !M@ !V PS- PE+ Y PGP t+ 5 X R tv(tv+) b++(b+)>b++++ DI(DI+) D-- G e->e++++ h! !r y
------END GEEK CODE BLOCK------
Reply With Quote
  #14  
Old 10-22-2002, 06:25 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by Jeff
Kai:

That is true, however, as I understand it keypressed is far more efficient.
I'd hardly say 'far' more efficient. None of us really know how Graal's internal workings are organised. I could argue that the use of event flags like keypressed takes more cpu time because it requires Graal to search the flag list, for example, but either way the difference in efficiency is going to be negligible.
__________________
Reply With Quote
  #15  
Old 10-26-2002, 02:10 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by Kaimetsu


I'd hardly say 'far' more efficient. None of us really know how Graal's internal workings are organised. I could argue that the use of event flags like keypressed takes more cpu time because it requires Graal to search the flag list, for example, but either way the difference in efficiency is going to be negligible.
I think it totally depends on the situation...

If you already need to use a timeout loop for something else... just add the key checks to it...


If you don't have any timeouts... don't bother with one. Just use keypressed...
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
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:28 AM.


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