Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-04-2002, 08:42 AM
amonrabr amonrabr is offline
Scripter
Join Date: Nov 2001
Location: Brazil
Posts: 374
amonrabr is on a distinguished road
keypressed

I know, its easy use: "for" with oldkeys arrays to make "keypressed" and not keydown..
But the graal should have something fast as:
"if(keypressed(i)) blah blah blah"
Reply With Quote
  #2  
Old 04-04-2002, 08:47 AM
Slaktmaster Slaktmaster is offline
man with the mastahplan
Slaktmaster's Avatar
Join Date: Apr 2001
Location: Half-way over the river styx
Posts: 4,422
Slaktmaster is an unknown quantity at this point
Send a message via ICQ to Slaktmaster Send a message via AIM to Slaktmaster
Why?
Reply With Quote
  #3  
Old 04-04-2002, 08:58 AM
royce royce is offline
Banned
royce's Avatar
Join Date: Sep 2001
Location: Yakitinzen, China
Posts: 2,271
royce is on a distinguished road
Send a message via AIM to royce
Re: keypressed

Quote:
Originally posted by amonrabr
I know, its easy use: "for" with oldkeys arrays to make "keypressed" and not keydown..
But the graal should have something fast as:
"if(keypressed(i)) blah blah blah"
So basically you want keypressed instead of keydown? I think your insane. Just think of it as another language.
Reply With Quote
  #4  
Old 04-04-2002, 11:14 AM
amonrabr amonrabr is offline
Scripter
Join Date: Nov 2001
Location: Brazil
Posts: 374
amonrabr is on a distinguished road
Angry

¬¬'' ..no comments...


Keypressed you have to RELEASE the key!!!

try this script and u will understand..
timeout=.05;
if (keydown(5)&&this.mode==0){this.mode=1}
if (keydown(5)&&this.mode==1){this.mode=0}
if (this.mode==1){setplayerprop #c,1;}else setplayerprop #c,2;

I wanna press S and say 1.. if I press S again say 2.. but the timeout is too fast and will be showing {1,2,1,2,1,2,1,2,1... very fast}..
There is an easy way to do release keys..

setarray this.key,10;
setarray this.oldkey,10;
for (i=0;i<10;i++)
{this.key[i]=this.oldkey[i];
this.oldkey[i]=keydown(i);}

¬¬'' Did u get now???
Did u see somewhere menus where you press D to open, S to the first choise and A to the second choise? the guy that made it didnt know the script that I said..
Reply With Quote
  #5  
Old 04-04-2002, 12:16 PM
royce royce is offline
Banned
royce's Avatar
Join Date: Sep 2001
Location: Yakitinzen, China
Posts: 2,271
royce is on a distinguished road
Send a message via AIM to royce
Quote:
Originally posted by amonrabr
¬¬'' ..no comments...


Keypressed you have to RELEASE the key!!!

try this script and u will understand..
timeout=.05;
if (keydown(5)&&this.mode==0){this.mode=1}
if (keydown(5)&&this.mode==1){this.mode=0}
if (this.mode==1){setplayerprop #c,1;}else setplayerprop #c,2;

I wanna press S and say 1.. if I press S again say 2.. but the timeout is too fast and will be showing {1,2,1,2,1,2,1,2,1... very fast}..
There is an easy way to do release keys..

setarray this.key,10;
setarray this.oldkey,10;
for (i=0;i<10;i++)
{this.key[i]=this.oldkey[i];
this.oldkey[i]=keydown(i);}

¬¬'' Did u get now???
Did u see somewhere menus where you press D to open, S to the first choise and A to the second choise? the guy that made it didnt know the script that I said..
I understand now. Need to explain more thorough next time . Can't you withdo with what we have already...? I think what we have now is enough rather than a keypress.
Reply With Quote
  #6  
Old 04-04-2002, 01:08 PM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
couldnt you just do while (keydown(#)) {stuff}
Reply With Quote
  #7  
Old 04-04-2002, 07:19 PM
Spanko Spanko is offline
Squeaker of Soles
Spanko's Avatar
Join Date: Nov 2001
Location: The Netherworl...lands
Posts: 1,366
Spanko is on a distinguished road
Send a message via ICQ to Spanko Send a message via AIM to Spanko Send a message via Yahoo to Spanko
Not necesarry, so I see no real point in adding it.
__________________

ICQ: 125283920
MSN: [email protected]
AIM: Squeax0r
Squeaker seems unable to access the forum using this account.. tis a sad day.
Now with occasional Asuka flavour! Ooops a bit too much...
Asuka should be king of Dustari!

"Y'know, some days even my lucky rocketship underpants don't even help."
Reply With Quote
  #8  
Old 04-05-2002, 01:47 AM
mikepg mikepg is offline
Registered User
Join Date: Nov 2001
Location: VA, USA
Posts: 501
mikepg is on a distinguished road
Send a message via AIM to mikepg Send a message via Yahoo to mikepg
umm

from what I read....

you have a problem of going straight from one number to the other...having an "if (keypressed(#))" wont solve anything, because that would be a one-time action that is sent, like playerchats.

If youve ever done
NPC Code:

if (timeout) {
if (playerchats) {message AHH!;
}
timeout = .1;
}



You'll notice nothing ever happens when you speak...because the chance of the player chatting at the right time (when the timeout loop reaches the IF), are like 1 billion to 1, so if (keypressed(#)) wont work for that reason.

but, to make it so the player doesnt need to have 0.05 second reflexes, you can add a function, like:
NPC Code:

if (timeout) {
if (keydown(5)) { modechange();
}
timeout = 0.5;
}

function modechange() {
this.mode=1-this.mode;
sleep .5;
}


*Note : this can be done without a function, but functions are more organized*
that way the program only waits when a key is pressed...or...you can do this:

NPC Code:

if (timeout) {
if (this.wait>0) this.wait-=1;
if (keydown(5)&&this.wait=0) {this.mode=1-this.mode; this.wait=10;}
timeout = 0.05;
}



that will make it so the NPC will not respond to the s key until .5 seconds have passed since the last press.
__________________
~War Lord Mpg2
Bravo Online's Asst. Staff Manager

"Sittin by the tree, sippin eggnog, waitin on christmas gifts"
Reply With Quote
  #9  
Old 04-05-2002, 01:15 PM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
Yes, it's called using timers and making a wait variable. That is how most all the scripts are done that use keydown in that manner.

I thought this was a topic for like, if a key is being held down, as that might be more useful for key combinations of things.. like for example, the ingame inventory dropping system (holding S and pressing A to cycle through items) That might be more helpful, even though it's possible to do anyway.

There are lots of commands that would be helpful, but most all commands that people request can be done with the current scripting, plus you get the advantage of being able to do more things with a script then having a simple command that is limited to certain things.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #10  
Old 04-05-2002, 02:31 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 konidias
Yes, it's called using timers and making a wait variable. That is how most all the scripts are done that use keydown in that manner.


I know I've never done it that way. I can't even imagine what you're describing.
__________________
Reply With Quote
  #11  
Old 04-05-2002, 06:19 PM
Spanko Spanko is offline
Squeaker of Soles
Spanko's Avatar
Join Date: Nov 2001
Location: The Netherworl...lands
Posts: 1,366
Spanko is on a distinguished road
Send a message via ICQ to Spanko Send a message via AIM to Spanko Send a message via Yahoo to Spanko
Quote:
Originally posted by Kaimetsu




I know I've never done it that way. I can't even imagine what you're describing.
NPC Code:
if (created||timeout) {
if (keydown(4)&&this.temp==0) {
this.bleh=1-this.bleh;
this.temp=1;
}
else this.temp=0;
timeout=0.05;
}

Is what he means. Probably.
__________________

ICQ: 125283920
MSN: [email protected]
AIM: Squeax0r
Squeaker seems unable to access the forum using this account.. tis a sad day.
Now with occasional Asuka flavour! Ooops a bit too much...
Asuka should be king of Dustari!

"Y'know, some days even my lucky rocketship underpants don't even help."
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:58 PM.


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