Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-08-2002, 02:32 AM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
Chrisz: Storing a hell of a lot of info....

Chrisz: How can i store LOADS of info in a string.... like
client.boxes="box1" "box7"
and then.... arf make it so i can select what box i have?
and no im not asking for scripts just i havent ever done
anything liek this.....
Reply With Quote
  #2  
Old 06-08-2002, 03:00 AM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
Talking =o Idea....

i could set each one as.... set hasbox1!

buuuut.... How would i access em all?? Without doing a HUGE EEK
script....

if (hasbox#v(this.box))
Obviously that dont work.... any ways around it? :X
Reply With Quote
  #3  
Old 06-08-2002, 03:24 AM
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
String arrays and for loops are what you seek.

String arrays are basically string which can contain multiple parts of informatoin in an easily accesible way, string arrays should be explained in newfeatures.txt somewhere (Which should be in your Graal folder), and a for loop is basically for (before loop action;condition to stop performing;End of loop action), or to make an example of cade which works the same as the for loop:
NPC Code:
if (created) {
before loop action;
while (condition to stop performing) {
Other stuff;
end of loop action;
}
}


Is actually equal to:
NPC Code:
if (created) {
for (before loop action;condition to stop performing;end of loop action) {
other stuff;
}
}



With a for loop in combination with a string you can also make use of the sarraylen(sarrayname) function to make the for loop exactly check all entries in the string array.


I hope that helps.
__________________

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
  #4  
Old 06-08-2002, 03:37 AM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
O.o String arry = non-p2p?

I have heard of loops (duh) but string arrays?? i heard of lists too but still string arrays? :O Can u explain or will i have to ponder....
Reply With Quote
  #5  
Old 06-08-2002, 03:40 AM
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
Re: O.o String arry = non-p2p?

Quote:
Originally posted by user13-xo
I have heard of loops (duh) but string arrays?? i heard of lists too but still string arrays? :O Can u explain or will i have to ponder....
This is the excerpt from newfeatures.txt about string arrays:

Quote:
- String arrays! they are saved in normal flags/string
variables and look like 'myarray=123,"45",67,"8,9"'
Commands/Functions:
addstring list,text;
insertstring list,index,text;
replacestring list,index,text;
removestring list,text;
deletestring list,index;
sarraylen(list)
lindexof(list,text)
#I(list,index) - gives you the string on place 'index'
Most of them speak for themselves, at least in my opinion.
__________________

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
  #6  
Old 06-08-2002, 03:55 AM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
lmao

O.o im retarded lol i know what they are now..... i never knew they were called string arrays O.o X.x But that dont explain how i should make the damn npc look....

if (keydown(1) && this.box>0) {
this.box-=1;
tokenize client.boxs;
while (!strcontains(#t(this.box),box#v(this.box))) {
this.box-=1;
}
}

See O.o so i can make like a selector like if you dont have a box
it misses it out.... =?
Reply With Quote
  #7  
Old 06-08-2002, 08:19 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Re: lmao

Quote:
Originally posted by user13-xo
O.o im retarded lol i know what they are now..... i never knew they were called string arrays O.o X.x But that dont explain how i should make the damn npc look....

if (keydown(1) && this.box>0) {
this.box-=1;
tokenize client.boxs;
while (!strcontains(#t(this.box),box#v(this.box))) {
this.box-=1;
}
}

See O.o so i can make like a selector like if you dont have a box
it misses it out.... =?
nuuuuuu! don't use tokenize!
use this:
addstring list, string;
and to access a string in the string array use:
#I(list, index);
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #8  
Old 06-10-2002, 08:22 PM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
tokenize2 ,,#s(this.boxes);
this.foundbox=false;
for (i=0;i<tokenscount;i++{
if (strequals(#t(i),wat ur trying to find here)){
this.foundbox=true;
}
}
if (this.foundbox==true){
say2 you found me loser;
}else say2 you didnt fine me lol;
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 06:47 PM.


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