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-02-2002, 03:54 AM
46and2 46and2 is offline
Registered User
Join Date: Jan 2002
Location: Behind You
Posts: 40
46and2 is on a distinguished road
Send a message via AIM to 46and2 Send a message via Yahoo to 46and2
Help with a couple commands

Hello, I have been going over the commands list as of late, and have passed over a few things multiple times that I honestly couldn't figure out what to do with. I don't understand Tokenize and arrays are a mystery to me. I understand that arrays can hold multiple numeric data, but I don't know how to access them properly. Looking over the board I have seen tokenize used before, but I don't see how it holds the variables(Words instead maybe?). I am sorry to sound like a beginner, but I am lost and was hoping if some of you could help me. Any explanations on what these commands do, what they are used for, and how they are used would be greatly appreciated. Thanks for your time.


DevaS posting on Masa's account.
__________________
Nightmareangel is the only one that posts on this account.

Nightmareangel -Asst- GC Admin.
Reply With Quote
  #2  
Old 08-02-2002, 04:34 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
NPC Code:
 
if (playerenters||timeout){
setarray MyArray,4; // creates and array of length 8 starts at 0
MyArray[0] = 23; // sets the first entry in the array to 23;
MyArray[1] = 17; // 2nd entry in the array
MyArray[2] = 32;
MyArray[3] = 2;

for (index=0;index<4;index++){
message MyArray[#v(index)] is equal to #v(MyArray[index]);
sleep 1;
}
timeout=1;
}



I always said I was a poor teacher. But here is a script using an array and a for loop together. Maybe it will make sense when you run it.

I believe it shows how you can use a for loop to access the information in an array. I assure you there are much more complex methods of data retrieval using multiple arrays.
__________________
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
  #3  
Old 08-02-2002, 04:46 AM
46and2 46and2 is offline
Registered User
Join Date: Jan 2002
Location: Behind You
Posts: 40
46and2 is on a distinguished road
Send a message via AIM to 46and2 Send a message via Yahoo to 46and2
Alright, so an array holds the different sets of numeric data, and you can call one part of the set by it's index. Would it be possible then, to show an image or put an explosion at 4 points in a level with a single command? Or would you still need to call each number in the array individually? That helped alot to give me an idea of what an array is and how it's information can be retrieved, thanks. Any suggestions on what I could try to script to see if I understand how to use an array? Sorry for all the questions, I am just happy to start learning about some of this stuff.
__________________
Nightmareangel is the only one that posts on this account.

Nightmareangel -Asst- GC Admin.
Reply With Quote
  #4  
Old 08-02-2002, 04:50 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
"tokenize <string>;" will split up <string> wherever there are commas or spaces. Each part of the string is stored in a different message code, starting with #t(0) and going up (#t(0), #t(1), #t(2), etc.)
__________________
Eric Kraft
Reply With Quote
  #5  
Old 08-05-2002, 10:34 PM
CrimsonLotus9838 CrimsonLotus9838 is offline
Registered User
Join Date: Jun 2002
Location: Newbie House
Posts: 10
CrimsonLotus9838 is on a distinguished road
Just to let you know, you can also create arrays like

dirgo = {0,-1,0,1,-1,0,1,0};

for those lazy typers (like me)
__________________
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
  #6  
Old 08-05-2002, 11:00 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by CrimsonLotus9838
Just to let you know, you can also create arrays like

dirgo = {0,-1,0,1,-1,0,1,0};

for those lazy typers (like me)
or you can use the built in vecx(dir) and vecy(dir)
does the exact same thing as dirgo.
Just one less line but it's shorter none the less.
__________________
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
  #7  
Old 08-05-2002, 11:01 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by Er1c
"tokenize <string>;" will split up <string> wherever there are commas or spaces. Each part of the string is stored in a different message code, starting with #t(0) and going up (#t(0), #t(1), #t(2), etc.)
Yeah it's a great deal like a string array. >.<
At least that's how I used it with my Menu.
__________________
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 09:24 AM.


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