Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Array Problem #245029
01/08/09 03:30
01/08/09 03:30
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I am having some trouble with arrays in my game.

first I declare an array as so:
Code:
var TestArray[5];


After I try to set its values in just one instruction like this: (I have tried several ways but it dosnt work)
Code:
TestArray = (1,2,3,4,5);
TestArray = {1,2,3,4,5};
set_mat(TestArray,(1,2,3,4,5));
set_mat(TestArray,{1,2,3,4,5});


I know i can set individual variables using a loop and an index for the array, but I really need to be able to fill the whole array with a set of values using only one instruction (Mabe something similar to what I have tried?)

I know that when declaring the array it works well. Example:
Code:
var TestArray[5] = {1,2,3,4,5};

But I need it to be initialized empty and filled with a set values later on, (and would prefer to fill it using only one instruction).

P.D.: I have searched the manual for anything related to "array" or "matrix" but found nothing usefull (except for the mat_set() functon, but it seems I cant get it to work).
Any Ideas?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Array Problem [Re: Carlos3DGS] #245047
01/08/09 07:56
01/08/09 07:56
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
If I am not mistaken there is no way to initialize an array like this, except in its declaration.
You could write your own function for this task, however it this will be limited by the number of arguments you can give.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1