|
|
Simple counter code not working... help please.
#215559
07/12/08 01:10
07/12/08 01:10
|
Joined: Feb 2002
Posts: 288 California, USA
jaknine
OP
Member
|
OP
Member
Joined: Feb 2002
Posts: 288
California, USA
|
Ok I am losing my mind here. It's been years since I last did a lot of work in 3DGS and I swear I'm not an idiot hahaha (I won third place in a 3DGS contest way back when so I at least know something lol). Anyway, I have the following code: action animate_this()
{
while(1)
{
my.skill1 += 2*time_step;
if (my.skill1 > 100) // if the animation section is finished playing...
{
my.skill1 -= 100; // start the animation over...
thePicker +=1;
show_Picker();
}
ent_animate(me,"dance",my.skill1,ANM_CYCLE);
wait(1);
}
}It's just a simple animation code that plays through a scene in an MDL file. It works fine, but... The part where I have "thePicker +=1;" is throwing me for a loop. It's supposed to count up by one every time the animation reaches 100% and loops back. Then the "show_Picker" just prints the current value of thePicker to the screen. The problem is, instead of it counting by 1 it's counting by 4. No matter what I change it refuses to count by one. Instead it goes: 4, 8, 12, 16, 18, and so on. So... How do I set a counter that will increase by 1 when a single cycle of an animation is finished playing?Bonus points for telling me why this counter only counts by 4s.
|
|
|
Re: Simple counter code not working... help please.
[Re: JazzDude]
#215568
07/12/08 04:01
07/12/08 04:01
|
Joined: Dec 2005
Posts: 478 India
msl_manni
Senior Member
|
Senior Member
Joined: Dec 2005
Posts: 478
India
|
show_Picker();
post the code related to show_Picker(). There must be some fault in there.
My Specialities Limited.
|
|
|
Re: Simple counter code not working... help please.
[Re: JazzDude]
#215571
07/12/08 05:14
07/12/08 05:14
|
Joined: Feb 2002
Posts: 288 California, USA
jaknine
OP
Member
|
OP
Member
Joined: Feb 2002
Posts: 288
California, USA
|
Try thePicker = thePicker + 1; Tried that and it does the same thing.
|
|
|
Re: Simple counter code not working... help please.
[Re: msl_manni]
#215573
07/12/08 05:18
07/12/08 05:18
|
Joined: Feb 2002
Posts: 288 California, USA
jaknine
OP
Member
|
OP
Member
Joined: Feb 2002
Posts: 288
California, USA
|
show_Picker();
post the code related to show_Picker(). There must be some fault in there. Here it is... STRING theTempString = "#64";
STRING theNumString = "#4";
text showthis_txt
{
layer = 15;
pos_x = 200;
pos_y = 5;
font = _a4font;
}
function show_Picker()
{
str_cpy(theTempString,"Picker = ");
str_for_num(theNumString,thePicker);
str_cat(theTempString, theNumString);
showthis_txt.string = theTempString;
showthis_txt.visible = on;
}I have theTempString set to a high number because I use it to test various strings on screen, not all of them so short. I should also add that my MDL file has 200 frames of animation in it with 12 scenes named from "AAA" to "LLL" if that makes a difference.
|
|
|
Re: Simple counter code not working... help please.
[Re: jaknine]
#215583
07/12/08 08:01
07/12/08 08:01
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
I swear I'm not an idiot hahaha That's a shame. Certainly, manni and I might like a few peers as company in the thread. 
define _ani1, skill52; // don't use skill 1, or share skills
var ani_nPicker = 0;
STRING s1[256];
STRING s2[256];
TEXT ani_t1 {
strings = 1;
pos_x = 0;
pos_y = 0;
layer = 15;
font = _a4font;
}
function anif_showPicker() {
str_cpy(ani_t1.string[0], "Picker: ");
str_for_num(s2, ani_nPicker);
str_cat(ani_t1.string[0], s2);
ani_t1.visible = ON;
}
// no parenthesis for action
action animate_this {
ani_nPicker = 0;
while(me != NULL) { //
my._ani1 += 2*time_step; // well...
//ani_nPicker += (ani_nPicker >= 99.998);
ani_nPicker += (ani_nPicker >= 100);
my._ani1 %= 100;
ent_animate(me,"dance", my._ani1, ANM_CYCLE);
anif_showPicker();
wait(1);
}
}
// model and / or this code could be a problem
|
|
|
Re: Simple counter code not working... help please.
[Re: tD_Datura_v]
#215730
07/13/08 01:58
07/13/08 01:58
|
Joined: Feb 2002
Posts: 288 California, USA
jaknine
OP
Member
|
OP
Member
Joined: Feb 2002
Posts: 288
California, USA
|
I swear I'm not an idiot hahaha That's a shame. Certainly, manni and I might like a few peers as company in the thread. Thanks for that code; even though the counter didn't work (heh) it got me thinking in different ways and I got done what I needed to get done in my program.
|
|
|
|