Array: This is like...

Non-platform specific questions.

Array: This is like...

Postby Kalladdolf » Sun Apr 05, 2009 4:54 pm

... a totally dumb question.
How do I create a global double array variable in GE (something like var1[var2][var3])?
I mean, GE lets me create a single array. And I could also create the variable manually (in the script).
But it needs to be global and ext int doesn't work.
Meh, I'm sure I'm overlooking a button or something.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Array: This is like...

Postby makslane » Sun Apr 05, 2009 8:08 pm

Just create in the Global Code Editor. For example, to create a bidimensional integer array:

Code: Select all
int var2d[100][100];


The created var2d array will be accessible in any script.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Array: This is like...

Postby skydereign » Sun Apr 05, 2009 8:17 pm

Do you mean make the array dynamic without global code? Or just create the array. Because in global code you would just make it like this,
Code: Select all
int ARRAY[x][y];

The only problem with this is that x and y must be predetermined. You could then use a struct wrapper to make it dynamic... Though it sounds like you want to do this with the gameEditor built in tools, which I don't think you can do.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Array: This is like...

Postby Kalladdolf » Sun Apr 05, 2009 8:30 pm

Well, thanks guys, it doesn't matter to me how it's done, just that I have it there, globally accessible and bidimentional. +1 for both of ya.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Array: This is like...

Postby Kalladdolf » Mon Apr 06, 2009 7:54 am

Okay, something else has just turned up: Runtime Error: "WRITE attempted before allowed access area."
What's that mean?
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Array: This is like...

Postby makslane » Mon Apr 06, 2009 10:55 am

Make sure the index used in the array is >= 0 and < the declarated limit.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Array: This is like...

Postby Fuzzy » Mon Apr 06, 2009 3:56 pm

It means you are trying to write outside the limits of the array.

The array runs from 0 to size-1. So an array of 100 is from 0 to 99.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Array: This is like...

Postby Kalladdolf » Mon Apr 06, 2009 5:02 pm

Right now I was not exceeding the limit... I was just using variables as index(es).
Well, I'll try to set the appropriate "if"-conditions. Maybe it'll work then...
EDIT: It worked. Finally. Be back with more array issues later (hopefully not).
Thanks so far.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron