Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, howardR, sleakz), 674 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using ent_animate ... but how ? #443911
07/27/14 21:09
07/27/14 21:09
Joined: Mar 2014
Posts: 9
B
BBN Offline OP
Newbie
BBN  Offline OP
Newbie
B

Joined: Mar 2014
Posts: 9
What's wrong with this code:
Code:
action ent001()
{
my.skill1 = 0;
while(my.skill1 < 100)
{
ent_frame("death", my.skill1);
my.skill1 += 1;
}
wait(1);
}
}


Gets the error message:

> UNDECLARED IDENTIFIER <

?




Last edited by rayp; 11/03/14 22:07. Reason: changed topic title : "Error Message" does not really say that much, 4my taste ... greets
Re: Error message ... [Re: BBN] #443912
07/27/14 21:18
07/27/14 21:18
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Doesn't the error message say which function the UNDECLARED IDENTIFIER is? It should and I bet it says "ent_frame". Replace it with ent_animate (and pay attention to the different function arguments).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Error message ... [Re: BBN] #443916
07/27/14 21:37
07/27/14 21:37
Joined: Mar 2014
Posts: 9
B
BBN Offline OP
Newbie
BBN  Offline OP
Newbie
B

Joined: Mar 2014
Posts: 9
Change the code to:
Code:
var animation;

action ent001
{
animation = 0;
while(animation < 100) {ent_animate("death",animation); animation+=1; wait(1) ; }
}


It is now another error message:

Error in line 16 ...

That is > animation = 0; <

?

Last edited by rayp; 08/13/14 23:27. Reason: only added code - tags
Re: Error message ... [Re: BBN] #443920
07/27/14 22:24
07/27/14 22:24
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
action ent001()
You forgot the brackets.
Also why not declare animation locally?

Last edited by Ch40zzC0d3r; 07/27/14 22:24.
Re: Error message ... [Re: Ch40zzC0d3r] #443927
07/28/14 03:02
07/28/14 03:02
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Code:
ent_animate("death",animation);



You are missing a couple parameters wink

Code:
ent_animate(me,"death",animation, ANM_CYCLE);



Also, as Ch40zzC0d3r said: You can make your var local, by which he means placing it inside the action. Then several entities can use this action, and will not follow the same var amount.

Last edited by DLively; 07/28/14 03:06.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Error message ... [Re: DLively] #446893
11/03/14 21:59
11/03/14 21:59
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
ent_frame
Mhhh ... old ( and dead ) "C - Script" i guess.
Instead of asking such questions, a look into the manual, would help alot and is done in a few seconds.

Besides the already mentioned missing parameters, you scripted an oneshot animation ( plays animation only one time, after that it does nothing more ).
Also u missed "speed correction" via time_step. This means, animation plays slowly on old ( slow ) computers but fast on new ( fast ) machines. Using "+1" here instead of "+time_step*X" is ( in almost all cases ) a deadly ( and extremly ugly ) mistake.

This code here combines both, oneshot- and cycle- animationstyles, time corrected with time_step:
Code:
//flag1 OneShotAnm 0
action ENTanm_WED(){ // FLAG1 = checked in WED-prop-window: marked as oneshot animation
   while (my){
      my.skill1 += time_step;    // framerate independent 
      my.skill1 %= 100;          // skill1 range 0..100 [if(my.skill1>=100)my.skill1=0;]
      if (!is (my, FLAG1)) ent_animate (me, "idle", my.skill1, ANM_CYCLE);
      else{                      // oneshot: plays animation only one time
         ent_animate (me, "idle", my.skill1, NULL);
         if (my.skill1 >= 100) break;
      }
      wait (1);
   }
   wait (1);                     // btw always(!!!) wait single frame be4u remove ent's  
   ptr_remove (me);              // btw#2 dont(!!!) use in ent / particle - event's
}


Peace


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;

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