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 08-03-2002, 07:11 PM
thesmoothcriminal thesmoothcriminal is offline
Lv.1 Internet Bully
thesmoothcriminal's Avatar
Join Date: Jul 2002
Location: player x,player y
Posts: 487
thesmoothcriminal will become famous soon enough
Send a message via AIM to thesmoothcriminal Send a message via Yahoo to thesmoothcriminal
keydown!!

how do i use keydown properly
my script only works for numbers
can someone right a script for a Character key eg.o
Reply With Quote
  #2  
Old 08-03-2002, 07:55 PM
SingleChance SingleChance is offline
Kill Pirates
Join Date: Apr 2002
Location: Canada
Posts: 1,296
SingleChance is on a distinguished road
:)

This is how the script goes
if(keydown(1-2-3-4-5-6)){whateverhere}
i thnk thats right not to sure about numbers...
Reply With Quote
  #3  
Old 08-03-2002, 09:39 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
the keydown event doesn't work by itself


i usually run inside a timeout
__________________
[signature]insert here[/signature]
Reply With Quote
  #4  
Old 08-03-2002, 09:50 PM
thesmoothcriminal thesmoothcriminal is offline
Lv.1 Internet Bully
thesmoothcriminal's Avatar
Join Date: Jul 2002
Location: player x,player y
Posts: 487
thesmoothcriminal will become famous soon enough
Send a message via AIM to thesmoothcriminal Send a message via Yahoo to thesmoothcriminal
anyone tell me the whole script for pressing o
Reply With Quote
  #5  
Old 08-03-2002, 09:59 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
'keydown' isn't like a 'playertouchsme' command you have to contantly check for it through a timeout loop...

NPC Code:

if (created) {
timeout=0.05;
}
if (timeout) {
if (keydown(#)) {
stuffs();
}
timeout=0.05;
}

Reply With Quote
  #6  
Old 08-03-2002, 10:33 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
Quote:
Originally posted by thesmoothcriminal
anyone tell me the whole script for pressing o
lol, look in the newfeatures text file

all you have to do is mod that one


i swear, why dont people just try anymore
__________________
[signature]insert here[/signature]
Reply With Quote
  #7  
Old 08-03-2002, 10:37 PM
thesmoothcriminal thesmoothcriminal is offline
Lv.1 Internet Bully
thesmoothcriminal's Avatar
Join Date: Jul 2002
Location: player x,player y
Posts: 487
thesmoothcriminal will become famous soon enough
Send a message via AIM to thesmoothcriminal Send a message via Yahoo to thesmoothcriminal
ummm i wrote:
if (created) {
timeout=0.05;
}
if (timeout) {
if (keydown(o)) {
say2 works();
}
timeout=0.05;
}

and it only says works when i press up
Reply With Quote
  #8  
Old 08-03-2002, 10:41 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
ugh, there is no keydown for o.

0.1.2.3.4.5.6.7.8.9.10
Up.Left.Down.Right.A.S.D.Q...
Reply With Quote
  #9  
Old 08-06-2002, 11:25 AM
CrimsonLotus9838 CrimsonLotus9838 is offline
Registered User
Join Date: Jun 2002
Location: Newbie House
Posts: 10
CrimsonLotus9838 is on a distinguished road
If you do keydown(o) and it only works when you press "up," there's a reason. The program thinks "o" is a variable name and since you didn't declare it before, it would be considered "0" and in the keydown() flag, a 0 is generated when the "up" key is hit.
__________________
It feels like little guards are gonna come up when ur on trial mode and say something like only p2p accounts can hump the walls! Now that wouldn't be good : /
Reply With Quote
  #10  
Old 08-06-2002, 10:08 PM
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
I believe keypressed is a valid event you can use..... whether your using keydown or keydown2....
__________________
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
  #11  
Old 08-07-2002, 12:45 AM
zorakid2001 zorakid2001 is offline
Banned
Join Date: Jul 2002
Location: Oregon USA <-- this place sux0rs
Posts: 113
zorakid2001 is on a distinguished road
Send a message via ICQ to zorakid2001 Send a message via AIM to zorakid2001
then how do they do the E and W keys on babylon??
Reply With Quote
  #12  
Old 08-07-2002, 01:16 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 zorakid2001
then how do they do the E and W keys on babylon??
keydown2...

it's all in the newfeatures text file.
__________________
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
  #13  
Old 08-08-2002, 12:30 PM
RavenTelvecho RavenTelvecho is offline
Registered User
RavenTelvecho's Avatar
Join Date: Apr 2002
Location: Toronto, Ontario, Canada
Posts: 0
RavenTelvecho is on a distinguished road
Send a message via ICQ to RavenTelvecho Send a message via AIM to RavenTelvecho Send a message via Yahoo to RavenTelvecho
Quote:
Originally posted by adam


keydown2...

it's all in the newfeatures text file.
or if ur lazy this should help
NPC Code:


if (keypressed) {
this.on=1-this.on;
if (this.on==1&&strequals(#p(1),o)) {message on;}
else { message off};
}



Quote:
- functions:
keycode(character) - gets the key code for the character
(identical to the windows virtual key code)
keydown2(keycode,ignorecase) - checks if a key has been pressed,
ignorecase must be true if you want to turn off the check
for shift/alt/control key, so keydown2(keycode(A),true) will be
true whenever you press A or Shift+A or Alt+A
- a script to display 'on' when pressing '1' and displaying
'off' when pressing '2':

if (keypressed) {
code = strtofloat(#p(0));
if (code==keycode(1,false)) message on;
else if (code==keycode(2,false)) message off;
}

The same without converting it to the key code:

if (keypressed) {
if (strequals(#p(1),1)) message on;
else if (strequals(#p(1),2)) message off;
}
__________________

^tuff newbie ;x
RavenTelvecho
!Booj
we are 'brothers'
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 03:51 PM.


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