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 10-04-2001, 02:14 AM
ownerofbabylon ownerofbabylon is offline
Lord Helmut
ownerofbabylon's Avatar
Join Date: Jun 2001
Location: Gainesville FL
Posts: 1,763
ownerofbabylon is on a distinguished road
Send a message via ICQ to ownerofbabylon Send a message via AIM to ownerofbabylon
system

im working on a system for babylon but i need to know somthing. I want it so it can detect when a player hits a key and it does somthing. So say a player pushes a + up at the same time and i want it to show sprites 2 then 3. How would i make it so it did this in real time? My guess is timeouts but im not sure
__________________


Warrior of Light

WWW.BABYLONSERVER.COM
Reply With Quote
  #2  
Old 10-04-2001, 02:30 AM
Enigma_GP6 Enigma_GP6 is offline
Banned
Join Date: Jul 2001
Location: Who?
Posts: 261
Enigma_GP6 is on a distinguished road
Send a message via ICQ to Enigma_GP6 Send a message via AIM to Enigma_GP6
It is probably something simple like keydown...... for example:

PHP Code:
if (keydown(keynumber)&&keydown(keynumber()){
//commands here sor gosh sakes;

Like something like that? Or please explain yourself better.

-Rebel95
Reply With Quote
  #3  
Old 10-04-2001, 02:40 AM
ownerofbabylon ownerofbabylon is offline
Lord Helmut
ownerofbabylon's Avatar
Join Date: Jun 2001
Location: Gainesville FL
Posts: 1,763
ownerofbabylon is on a distinguished road
Send a message via ICQ to ownerofbabylon Send a message via AIM to ownerofbabylon
but i think it needs to constantly check to see if they are pushing it
__________________


Warrior of Light

WWW.BABYLONSERVER.COM
Reply With Quote
  #4  
Old 10-04-2001, 03:00 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by ownerofbabylon
but i think it needs to constantly check to see if they are pushing it

if so then just add a timeout loop
Reply With Quote
  #5  
Old 10-04-2001, 03:28 AM
Enigma_GP6 Enigma_GP6 is offline
Banned
Join Date: Jul 2001
Location: Who?
Posts: 261
Enigma_GP6 is on a distinguished road
Send a message via ICQ to Enigma_GP6 Send a message via AIM to Enigma_GP6
oh, okay, well, you have to be more specific, as I remember, if you want it to do that, it would go something like this, but you may revise all you want, because I am making this up as I go.:

PHP Code:
while (keydown(keyname)&&(keydown(name)){
if (
keydown(name)&&keydown(name)){
//commands here,
//like the sprites and stuff like that, this in
//a loop, but with an 'if' command,
//so only if, beacuse I found that a plain
// 'while' loop seems to not work right on some
//occasions. Just put in stuff like 
playersprite=spritename;
 }
}
timeout 0.05
And that outhgt to do it, although I don't exactly know what you mean, but that is what I am getting out of what you need.

-Rebel95
Reply With Quote
  #6  
Old 10-04-2001, 05:56 AM
Cybnext_Design Cybnext_Design is offline
Registered User
Join Date: Jun 2001
Posts: 244
Cybnext_Design is on a distinguished road
Send a message via AIM to Cybnext_Design
Quote:
Originally posted by Enigma_GP6
oh, okay, well, you have to be more specific, as I remember, if you want it to do that, it would go something like this, but you may revise all you want, because I am making this up as I go.:

PHP Code:
while (keydown(keyname)&&(keydown(name)){
if (
keydown(name)&&keydown(name)){
//commands here,
//like the sprites and stuff like that, this in
//a loop, but with an 'if' command,
//so only if, beacuse I found that a plain
// 'while' loop seems to not work right on some
//occasions. Just put in stuff like 
playersprite=spritename;
 }
}
timeout 0.05
And that outhgt to do it, although I don't exactly know what you mean, but that is what I am getting out of what you need.

-Rebel95
I don't believe you would need a timeout, an if (keydown(#)) should just work without any loop.

And I believe yours would lag a lot.
__________________
Graal2001 NPC Maker
Frolic Owner
Aim: C Y B N E X T
Reply With Quote
  #7  
Old 10-04-2001, 06:28 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by Cybnext_Design


I don't believe you would need a timeout, an if (keydown(#)) should just work without any loop.

And I believe yours would lag a lot.
now that i think of it i dont think it needs a timeout either
Reply With Quote
  #8  
Old 10-04-2001, 06:39 AM
Shard_IceFire Shard_IceFire is offline
Registered User
Shard_IceFire's Avatar
Join Date: Jun 2001
Location: Eastern Harkoonia
Posts: 861
Shard_IceFire is on a distinguished road
keydowns never really work correctly unless they're in a timeout loop.
__________________

-=Shard IceFire=-
Reply With Quote
  #9  
Old 10-04-2001, 07:07 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by Shard_IceFire
keydowns never really work correctly unless they're in a timeout loop.
they might work more accuratley, but they'll function the same
Reply With Quote
  #10  
Old 10-04-2001, 08:24 AM
James James is offline
LOCAL DOUCHEBAG
James's Avatar
Join Date: Aug 2001
Location: Oregon
Posts: 3,132
James is a splendid one to beholdJames is a splendid one to beholdJames is a splendid one to beholdJames is a splendid one to behold
Send a message via AIM to James
Couldnt you possibly do something different than a timeout? Possibly if (hasweapon) etc?
__________________

JAMES BAY PACKERS
2011 FANTASY FOOTBALL CHAMPIONS
2012 FANTASY FOOTBALL CHAMPIONS


“If I can slow it down in my mind... things will be fine."

-Aaron Rodgers
2011's NFL Most Valuable Player




Reply With Quote
  #11  
Old 10-04-2001, 08:25 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by James
Couldnt you possibly do something different than a timeout? Possibly if (hasweapon) etc?
dunno but its isweapon and hasweapon(weaponname)
Reply With Quote
  #12  
Old 10-04-2001, 08:26 AM
James James is offline
LOCAL DOUCHEBAG
James's Avatar
Join Date: Aug 2001
Location: Oregon
Posts: 3,132
James is a splendid one to beholdJames is a splendid one to beholdJames is a splendid one to beholdJames is a splendid one to behold
Send a message via AIM to James
Quote:
Originally posted by btedji


dunno but its isweapon and hasweapon(weaponname)
err i know that, i was just putting it in a short way, thats why I said etc
__________________

JAMES BAY PACKERS
2011 FANTASY FOOTBALL CHAMPIONS
2012 FANTASY FOOTBALL CHAMPIONS


“If I can slow it down in my mind... things will be fine."

-Aaron Rodgers
2011's NFL Most Valuable Player




Reply With Quote
  #13  
Old 10-04-2001, 08:29 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
NPC Code:

if (created || playerenters) {
this.keys={0,0,0,0,0,0,0,0,0,0,0};
timeout=0.05;
}
if (timeout) {
GetKeys();
DoActions();
timeout=0.05;
}
function GetKeys() {
for (i=0;i<11;i++) {
this.keys[i]=keydown(i);
}
}
function DoActions() {
if (this.keys[0]==1 && this.keys[6]==1) {
DoStuff;
}
}


Try that
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
Reply With Quote
  #14  
Old 10-04-2001, 07:10 PM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by Kaimetsu


Yes it does. Keydown is not an event.
ahhh finally a straight answer!!!
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:06 AM.


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