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 09-29-2001, 11:04 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
keydown

How can i make it so that you cant hold down a key and the action keep going over and over?

Kind of like the sword swing.

You hit 'S' and you swing ur sword, but if you hold it down nothing happens. And you release it and hit it again, and it swings again.

I need this so that i can make something scroll differently, i have tried many ways and here is one of them:

PHP Code:
  //Check for Keydown
    
if (keydown(0)) {
      if (
this.keyd==&& this.fruit<=5) {
        
this.keyd 1;
        
this.fruit++
      }
    }else{
this.keyd 0;}

    if (
keydown(2)) {
      if (
this.keyd==&& this.fruit>=0) {
        
this.keyd 1;
        
this.fruit--;
      }
    }else{
this.keyd 0;} 
__________________
Graal2001 NPC Maker
Frolic Owner
Aim: C Y B N E X T
Reply With Quote
  #2  
Old 09-29-2001, 11:34 AM
Xaviar Xaviar is offline
Registered User
Join Date: Aug 2001
Location: Fairyland
Posts: 463
Xaviar is on a distinguished road
Send a message via ICQ to Xaviar Send a message via AIM to Xaviar
Re: Re: keydown

Quote:
Originally posted by Kaimetsu
Use a different var for each key. An array would work.
Your a genius , I woulda stared at that for like half an hour before it woulda popped into my head "Hey! Your using the same variable!"
__________________
One by one, the penguins steal my sanity.

*cookie for Xaviar* --Originally posted by Tyhm

--Xaviar

A m e r i c a
Reply With Quote
  #3  
Old 10-03-2001, 03:15 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
NPC Code:

if (keydown(0)&& this.fruit<=5) {
this.fruit++;
}

if (keydown(2) && this.fruit>=0) {
this.fruit--;
}




i think this would work too
Reply With Quote
  #4  
Old 10-03-2001, 08:21 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 btedji
NPC Code:

if (keydown(0)&& this.fruit<=5) {
this.fruit++;
}

if (keydown(2) && this.fruit>=0) {
this.fruit--;
}




i think this would work too
You obviously didn't read my post.

That script would just allow you to hold down the key, and that is exactly what i don't want.
__________________
Graal2001 NPC Maker
Frolic Owner
Aim: C Y B N E X T
Reply With Quote
  #5  
Old 10-03-2001, 09:21 AM
entravial entravial is offline
Registered User
entravial's Avatar
Join Date: Mar 2001
Posts: 825
entravial is on a distinguished road
Send a message via ICQ to entravial Send a message via AIM to entravial Send a message via Yahoo to entravial
~AlphaFlame~

Using your original method...

//Check for Keydown
if (keydown(0)) {
if (this.keyd1==0 && this.fruit<=5) {
this.keyd1 = 1;
this.fruit++
}
}else{this.keyd1 = 0;}

if (keydown(2)) {
if (this.keyd2==0 && this.fruit>=0) {
this.keyd2 = 1;
this.fruit--;
}
}else{this.keyd2 = 0;}
__________________


If the post says ~AlphaFlame~, that's who's posting. If not, it's Entravial (owner)
Reply With Quote
  #6  
Old 10-03-2001, 09:23 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
Just to let you guys know, it has already been fixed.

So no need to keep posting answers.

Kaimetsu, can you delete this thread now?
__________________
Graal2001 NPC Maker
Frolic Owner
Aim: C Y B N E X T
Reply With Quote
  #7  
Old 10-03-2001, 07:15 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 Cybnext_Design
Just to let you guys know, it has already been fixed.

So no need to keep posting answers.

Kaimetsu, can you delete this thread now?
this thread doesnt need to be deleted, it is helpful for other people
Reply With Quote
  #8  
Old 10-03-2001, 08:28 PM
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
Yeah...well I had the same problem with keydown stuff, but I still don't get how to incorperate arrays like Kaimetsu said...
__________________

-=Shard IceFire=-
Reply With Quote
  #9  
Old 10-03-2001, 08:42 PM
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
Quote:
setarray this.keys,4;
for(i=0;i!=4;i++){
this.keys[i]=keydown(i);
}
Ok I stared at that script for a minute and couldn't figure it out...what exactly does it do?
__________________

-=Shard IceFire=-
Reply With Quote
  #10  
Old 10-03-2001, 09:02 PM
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
Umm...ok!
__________________

-=Shard IceFire=-
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:41 PM.


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