Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, VoroneTZ, dpn), 1,346 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
"temp" undeclared identifier #368948
04/29/11 19:53
04/29/11 19:53
Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Ericmor Offline OP
Member
Ericmor  Offline OP
Member

Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Hi,
I´m currently translating my old A7 .wdl scripts to the new Lite-C for A8.
I´m being able to update most of my .wdl code to Lite-C so far, but bumped into a tricky one now:
Code:
if(event_type == EVENT_SCAN)
     {
      ...
      vec_set (temp.x, my .x);
      vec_to_screen (temp.x, camera_1);
      ...


it´s generating the following error message:

ERROR in items.c, line 181:
'temp' undeclared identifier"
< vec_set (temp.x, my .x);
>

Way tricky to find the replacement syntax, because the code in the examples is the same i´m using. Is 'temp' replaced by another syntax, or the ´temp´ concept isn´t used anymore in the new codes?
Thanks in advance.

Re: "temp" undeclared identifier [Re: Ericmor] #368949
04/29/11 20:04
04/29/11 20:04
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
"temp.x" is a vector, before using any vector, you need yo declare it.
Example:
VECTOR temp;


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: "temp" undeclared identifier [Re: 3run] #368962
04/30/11 00:16
04/30/11 00:16
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You are right, temp is not used in lite-c, you have to declare it by yourself.

Re: "temp" undeclared identifier [Re: Widi] #368978
04/30/11 07:47
04/30/11 07:47
Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Ericmor Offline OP
Member
Ericmor  Offline OP
Member

Joined: Apr 2007
Posts: 125
Brazil - São Paulo
SIGH... i think i understand, thanks guys.
To be able to still use the old code without changing it too much (at least in this first syntax translation stage), i´m declaring the 'temp' vector inside the function, in hopes it will work again... or so i tought.
After i do this, THREE simultaneous errors appear in the runtime warning:


ERROR in items.C line 216:
Cannot convert FIXED to STRUCT vector
< temp = my.skill1
>

ERROR in items.C line 217:
Can not convert 'struct vector' to 'Long'
< controlitem[temp]=1;
>

...and the third is your standard syntax-need-a-fix/everthing-is-case-sensitive-now/etc buggy code.
But for the first two errors... crap, i migt need to declare exclusive 'temps'
for each of them, probably?

Re: "temp" undeclared identifier [Re: Ericmor] #368979
04/30/11 07:55
04/30/11 07:55
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
This is my standard for temp to use it as I was used to when writing in C-Script:
VECTOR* temp = {x=0;y=0;z=0;}

then you have to write probably (is long ago that I used skills) something like this:
temp.x = skill1;
temp.y = skill2;
temp.z = skill3;

Don't know whether there is a more elegant way.

Re: "temp" undeclared identifier [Re: Pappenheimer] #368983
04/30/11 08:37
04/30/11 08:37
Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Ericmor Offline OP
Member
Ericmor  Offline OP
Member

Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Nope... declaring the vector as a global var like you did still gives the same errors... but thanks anyway.
My mistake here is to have been away from coding for so long.
Those functions are all outdated, and their structural logic is probably very flawed.
Still, i´d like to make the old code run again to fix it up little by little, but it seems that i´ll already have to make essential changes to it just to get to this stage.
Many parts have been taken from other old examples, and many functions might be easily replaced by small instructions, perhaps.
Still, i´ll give the initial fix-it a go.

Re: "temp" undeclared identifier [Re: Ericmor] #368984
04/30/11 09:05
04/30/11 09:05
Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Ericmor Offline OP
Member
Ericmor  Offline OP
Member

Joined: Apr 2007
Posts: 125
Brazil - São Paulo
Well, that particular error message disappeared when i declared a new ´temp´ var inside the function itself (renamed it to be used especifically on that place only):
Code:
...
             var tempskill01;
             tempskill01=my.skill1;
             controlitem[tempskill01]=1;
...


Now i´m have my first trouble with an ACTION function... (still couldn´t find a working ACTION Lite-C structure example).
Well, one problem at a time, i guess... thanks again, everybody.

Re: "temp" undeclared identifier [Re: Ericmor] #368985
04/30/11 09:13
04/30/11 09:13
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
This is probably only a naming problem:

write 'action myAction()' - with the brackets
instead of
action myAction - without brackets

Re: "temp" undeclared identifier [Re: Pappenheimer] #369009
04/30/11 15:24
04/30/11 15:24
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
"temp = my.skill1" doesn't work in lite-c, it's a lot less forgiving than c-script. you need.

vec_set(temp.x,my.skill1);


I had a problem going from c-script to lite-c as well but it's worth it as it is so much more powerful. I love being able to pass near limitless parameters. Saved hundreds of lines of code because of that.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: "temp" undeclared identifier [Re: Ericmor] #369016
04/30/11 17:34
04/30/11 17:34
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: Ericmor
Code:
...
             var tempskill01;
             tempskill01=my.skill1;
             controlitem[tempskill01]=1;
...


You know that this piece of code is pointless and can be replaced by the line "controlitem[my.skill1]=1;" ?


Always learn from history, to be sure you make the same mistakes again...
Page 1 of 2 1 2

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