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
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,655 guests, and 7 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
"Subscript requires array or pointer type" in WED run #220726
08/08/08 22:56
08/08/08 22:56
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline OP
Member
Enduriel  Offline OP
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
Hello gamestudio community. I don't know how to start but since this is my first time here i'd like to introduce myself. I'm Yasin, I live in Sweden and been visiting this site frequently but never actually registered, great community with lots of nice people who share there abbilities like the shaders guy (can't remember his name atm ^^) etc etc. I've 6 years of 3dsmax experience and 2 years of maya 2008 from school so I guess if I have time I can perhaps model some stuff for you guys =]

anyway i've been using gamestudio a5 for a while now, like 3 years or so not for a serious project but for just trying different things out and small self projects. I got a7 some weeks ago.

I've used basketballbens turn based rpg tutorial (final fantasy) and I managed to get it to work with A7 in the past few weeks, i've also added alot of features like class changing, weapons changing, inventory code, another playable character so you are two in battle isntead of one and yes everything is done with c-script. Now!

i'm actually converting teh code to lite-c and i've got some problems.



//////////////Let's says this is my entity pointer:
Code:
ENTITY* white_mage;
ENTITY* temp_freezy;
var white_mage_frozen;



////////////this is the action with the entity assigned on it
Code:
action white_mage_act() {white_mage = me;}


//////////////these are the frames that the array will keep track of
Code:
var wait_start = 0; 
var wait_end = 1;
var white_mage_frames[6] = { 2,10,11,31,32,53 };


//////////////prototype for the function below
Code:
npc_animate(who, &frames, frozen);


//////////////then we got a function with this called inside it
Code:
npc_animate(white_mage, white_mage_frames, white_mage_frozen);


//////////////and this is the function we called above, temp_npc is who and who is white_mage etc etc
Code:
function npc_animate(who, &frames, frozen)
{
	temp_npc = who;
	
	if (frozen == yes) {goto end;}
	
	if ((temp_npc.frame > frames[wait_end])||(temp_npc.frame < frames[wait_start]))
	{temp_npc.frame = frames[wait_start];}
	temp_npc.frame += .7*time;
	if (temp_npc.frame > frames[wait_end]) {temp_npc.frame = frames[wait_start];}
	end:
}



////////////////////and here is that "frozens" code

Code:
function freeze_someone(freezy)
{
	temp_freezy = freezy;
	if (temp_freezy == white_mage) {white_mage_frozen = yes;}

}



as u see everything is connected to each other which gives full control, but when I tried converting the code to lite-c I get this error when I run it in Wed. Said something like Subscript requires array or pointer type at line 86 which was function npc_animate(.............)



I would really appreciate if someone could help me out on this part because almost all of the script is based on this style with pointers and stuff inside the parantheses of the functions.

THanks in advance and I look forward to share/learn new stuff from/with the community smile

Re: "Subscript requires array or pointer type" in WED run [Re: Enduriel] #220728
08/08/08 23:16
08/08/08 23:16
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Hi Yasin,

just a couple of things to iron out, (i only use A6 myself so if syntax has changed and you know you're right just ignore me wink )

in the var white_mage_frames[6] = { 2,10,11,31,32,53 };
when declaring an array, don't use braces.

this might lead to the compiler not thinking it's got an array which you've declared you're setting one

and which line is actually on line 86? it'll point it out straight away where the problem is

Hope this helps!

Re: "Subscript requires array or pointer type" in WED run [Re: MrGuest] #220733
08/09/08 00:19
08/09/08 00:19
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline OP
Member
Enduriel  Offline OP
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
Hey smile

thanks for your reply but in lite-c you have to use brackets for arrays

the line 86 is the function npc_animate(..........) {...........} inside the brackets, I think it's the syntax that is wrong and the engine doens't know how to handle "&frames" inside the parantheses.

Re: "Subscript requires array or pointer type" in WED run [Re: Enduriel] #220744
08/09/08 02:27
08/09/08 02:27
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline OP
Member
Enduriel  Offline OP
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
AH never mind smile found it thanks to the manual, I was supposed to put "*var" instead of "&" when I use arrays inside function parantheses.

Though I realised that Goto doens't work outside brackets in Lite-C so I can't skip some codes and ignore some parts of my scripts in different events. Is there any other way to do a goto command outside brackets in same function?

Re: "Subscript requires array or pointer type" in WED run [Re: Enduriel] #220745
08/09/08 02:29
08/09/08 02:29
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
just use
Code:
return;
inside the function if it's to just finish


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