Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 14,136 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
how can create "multidimensional arrays" #183793
02/14/08 10:54
02/14/08 10:54
Joined: Jul 2007
Posts: 69
fat32 Offline OP
Junior Member
fat32  Offline OP
Junior Member

Joined: Jul 2007
Posts: 69
hi
i create "multidimensional arrays" by 3dgs manual but i have problem :

var add_all_arr[100][100];
function test_arr_func(i_var,j_var){
while(i_var<=10 && j_var <=10){
add_all_arr[i_var][j_var]=int(random(10));
if(i_var<10){i_var+=1;}//if i under 10 add 1 count
if(i_var==10 && j_var<10){j_var+=1;}//if i==10 and j under 10 add 1 count
wait(1);

}
}
on_l=test_arr_func;

when run i have this error messages "Syntax error - - missing semicolon? [j]=int(random(10))

in the manual instruction said light c but when i include #include <acknex.h>
#include <default.c>

problem is continue?!

thank's hosein_dig (fat32)

Last edited by fat32; 02/14/08 11:00.

dobidob hosein_dig and max_man7000 game

HAPPY NEW YEAR !!
Re: how can create "multidimensional arrays" [Re: fat32] #183794
02/14/08 11:15
02/14/08 11:15
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
i think you can just use something like that:

add_all_arr[ 100 * j_var + i_var ]

Re: how can create "multidimensional arrays" [Re: kasimir] #183795
02/14/08 11:37
02/14/08 11:37
Joined: Aug 2005
Posts: 343
Germany
HPW Offline
Senior Member
HPW  Offline
Senior Member

Joined: Aug 2005
Posts: 343
Germany
Multidimensional arrays are possible with Lite-C.
I don't think the syntax of your array is the problem.
You just have a failure: int() is for C-Script only. Use integer() with Lite-C.
In C-Script multidimensional arrays can't be used and you must do it like kasimir posted.

Last edited by HPW; 02/14/08 11:42.

Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: how can create "multidimensional arrays" [Re: HPW] #183796
02/14/08 12:47
02/14/08 12:47
Joined: Jul 2007
Posts: 69
fat32 Offline OP
Junior Member
fat32  Offline OP
Junior Member

Joined: Jul 2007
Posts: 69
Syntax error - - missing semicolon? [j]=integer(random(10))

problem not fix .u can use example by full body(main function)

thanks


dobidob hosein_dig and max_man7000 game

HAPPY NEW YEAR !!
Re: how can create "multidimensional arrays" [Re: fat32] #183797
02/14/08 14:29
02/14/08 14:29
Joined: Jul 2007
Posts: 69
fat32 Offline OP
Junior Member
fat32  Offline OP
Junior Member

Joined: Jul 2007
Posts: 69
i want create a simple data base first index (i) for number row and second index (j) for content (row)

if possible please use example

thanks hosein_dig (fat32)


dobidob hosein_dig and max_man7000 game

HAPPY NEW YEAR !!
Re: how can create "multidimensional arrays" [Re: fat32] #183798
02/14/08 18:39
02/14/08 18:39
Joined: Aug 2005
Posts: 343
Germany
HPW Offline
Senior Member
HPW  Offline
Senior Member

Joined: Aug 2005
Posts: 343
Germany
Do you use Lite-C or C-Script?
Multidimensional arrays are only available in Lite-C!
In C-Script use a single array with a simple formula to fake multidimensional arrays:
Code:

// C-Script example of a pseudo database...
define col_index_num, 100; // 100 columns
define row_index_num, 100;
define dataset_health, 0;
define dataset_ammo, 1;
define dataset...
...
var my_table[1000]; // col_index_num * row_index_num
var my_dataset[col_index_num];

function myfunc()
{
var v_row = 13; // use dataset of the 13 th row
var v_col = 0;

while (v_col < col_index_num) // your columns (each col is a property of your dataset)
{
my_dataset[v_col] = my_table[v_row*col_index_num + v_col]; // copy from my_table to my_dataset for better handling
v_col += 1;
}

my.health = my_dataset[dataset_health];
my.ammo = my_dataset[dataset_ammo];
...
}



Last edited by HPW; 02/14/08 18:41.

Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: how can create "multidimensional arrays" [Re: HPW] #183799
02/14/08 22:31
02/14/08 22:31
Joined: Jul 2007
Posts: 69
fat32 Offline OP
Junior Member
fat32  Offline OP
Junior Member

Joined: Jul 2007
Posts: 69
i cannot use lite c before my script all them have error i am astray .
i don't know !?!

thanks HPW.i test your code.

u think lite c is better or c-script . i can't write two line by lite c u work by lite c ?.i work very better by c-script but that have too many limited special in array.u know where is best learn of lite c at base ?

thanks hosein_dig (fat32)


dobidob hosein_dig and max_man7000 game

HAPPY NEW YEAR !!
Re: how can create "multidimensional arrays" [Re: fat32] #183800
02/15/08 00:52
02/15/08 00:52
Joined: Aug 2005
Posts: 343
Germany
HPW Offline
Senior Member
HPW  Offline
Senior Member

Joined: Aug 2005
Posts: 343
Germany
Lite-C is better but difficult to learn. If you haven't much experience with programming, then you should start with C-Script until you haven't problems with the syntax anymore and than try to change the scripts to Lite-C.


Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: how can create "multidimensional arrays" [Re: HPW] #183801
02/15/08 09:12
02/15/08 09:12
Joined: Jul 2007
Posts: 69
fat32 Offline OP
Junior Member
fat32  Offline OP
Junior Member

Joined: Jul 2007
Posts: 69
i work c-script for one year (dobidob is my game 5440 line manual write).
i can understand c script too much syntax because three year i work vb and c++ , my big problem find a source for learn and run lite c code ,that need special program for run ? .because i cannot run lite c code in the game studio(in Aum67).

Code:
#include <litec.h>

int WinMain()
{
MessageBox (NULL, "Hello World!", "My first program", MB_OK | MB_ICONSTOP);

return (0);
}




dobidob hosein_dig and max_man7000 game

HAPPY NEW YEAR !!
Re: how can create "multidimensional arrays" [Re: fat32] #183802
02/15/08 17:44
02/15/08 17:44
Joined: Aug 2005
Posts: 343
Germany
HPW Offline
Senior Member
HPW  Offline
Senior Member

Joined: Aug 2005
Posts: 343
Germany
You can use SED (script editor of 3D GameStudio) to create your Lite-C scripts. Just make sure you named it for example "main.c" instead of "main.wdl" and include the litec.h at the top of the main script. You also need A7 to use Lite-C. A6 doesn't support it.
Your example code from aum67 can't run without the include of windows.h wich is needed for the MessageBox.
MessageBox is not a function of Lite-C. It's the same like in C++, you need some type of library or header files for some functions.

Code:

#include <litec.h>
#include <windows.h>
int WinMain()
{
MessageBox (NULL, "Hello World!", "My first program", MB_OK | MB_ICONSTOP);
return (0);
}



But be carefully with MessageBox in fullscreen mode of A7, you can't see the MessageBox there and must run it in window mode.

Last edited by HPW; 02/15/08 17:49.

Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Page 1 of 2 1 2

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

Gamestudio download | 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