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-21-2003, 10:39 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Question Arrays

Can someone give me some info on arrays? I tried to declare one like this:

this.array = {1,2,3,4,5,6,7,8,9};

but it didn't seem to work.
Also, how would you make multi-dimensional arrays in graal? And what about setarray? Thanks in forward (or whatever)
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #2  
Old 09-21-2003, 10:43 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Setarray makes string arrays. It's ideal for text or a mixture of text and numbers.
Reply With Quote
  #3  
Old 09-21-2003, 10:45 PM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Well your array looks fine to me. You can read those numbers with
this.array[0] through this.array[8].

Ex:

say2 #v(this.array[2]); would return 3!
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #4  
Old 09-21-2003, 10:48 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally posted by protagonist
Setarray makes string arrays. It's ideal for text or a mixture of text and numbers.
setarray makes variable arrays, not string.

Oh and setarray:

NPC Code:
setarray this.test,5;


would then create the variable:
NPC Code:
this.test={0,0,0,0,0};


And then you could manually access each value by:
NPC Code:
this.test[2]=8;


would make the third value eight.
Reply With Quote
  #5  
Old 09-21-2003, 10:50 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally posted by DustyPorViva


setarray makes variable arrays, not string.
Ewps. Read it wrong.
Reply With Quote
  #6  
Old 09-21-2003, 10:55 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
multi dim arrays will be supported in the new engine
Reply With Quote
  #7  
Old 09-22-2003, 01:25 AM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Quote:
Originally posted by DustyPorViva

NPC Code:
setarray this.test,5;


would then create the variable:
NPC Code:
this.test={0,0,0,0,0};


And then you could manually access each value by:
NPC Code:
this.test[2]=8;


would make the third value eight.
But you cant

this.test[2]=8;

until you

setarray this.test,5;
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #8  
Old 09-22-2003, 01:34 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
You can manually make an array by this.test={x,x,x,};

thats why I said: then
Reply With Quote
  #9  
Old 09-22-2003, 06:16 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Okay people, thanks, i now understand
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
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 05:18 PM.


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