![]() |
Arrays...?
Hi!
I am a pretty good scripter, but one thing that I just skipped over when I was learning was arrays. I was wondering, exactly how do you use them? And what can they be used for? Thanks. |
they are used for storing more than one thing in a variable. it would be like hearts(1) and hearts (2) but the variable would just be hearts but it breaks it up into parts
|
Re: Arrays...?
Quote:
NPC Code: |
Re: Re: Arrays...?
Quote:
if(created){ this.x={1,30,50,25}; this.y={5,20,18,30}; } for? |
Re: Re: Re: Arrays...?
Quote:
this.x[0]=1 this.x[1]=30 this.x[2]=50 this.x[3]=25 |
Re: Re: Re: Re: Arrays...?
Quote:
|
Re: Re: Re: Re: Re: Arrays...?
Quote:
doing this.array={1,2,3,4} is far more efficient |
Re: Re: Re: Re: Re: Re: Arrays...?
Quote:
|
=/ I still don't get why you would need them...
|
Quote:
you could do this: this.appleprices={30,40,50,50} then call it like this: players[0].rupees-=this.appleprices[this.appletype]; which would be far more efficient than having variables for each apple price and would be easy to customize if you had at the beginning of a script |
Quote:
rupees-=this.appleprices[this.appletype]; does it just choose one of the 'appleprices' numbers at random or something? |
| All times are GMT +2. The time now is 06:21 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.