Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → What is false with this cog
What is false with this cog
2001-05-11, 7:38 AM #1
What is false with this code ?
goal 1 & 2 are visible
but only goal 1 should be visible at startup.

# LEVEL1_GOALS.COG
#
# Goals:
# 0 - hallo
# 1 - test
# 2 - ende
#
# ==================================================================

symbols
int player local

message startup
message entered
message touched

sector sectorGoal0
thing thingGoal1
surface surfaceGoal2

sound soundGoal0=accomplish1.wav local
sound soundGoal1=accomplish1.wav local
sound soundGoal2=accomplish1.wav local

int done0=0 local
int done1=0 local
int done2=0 local
end

# ==================================================================

code
startup:
player = GetLocalPlayerThing();
SetInv(player, 99, 1000);
SetGoalFlags(player, 0, 1);
// SetGoalFlags(player, 1, 1); // Not visible at startup
// SetGoalFlags(player, 2, 1); // Not visible at startup
Return;

entered:
// Goal: 0
if((!done0) && (GetSenderRef() == sectorGoal0))
{
jkPrintUNIString(player, 350);
PlaySoundThing(soundGoal0, player, 1.0, -1, -1, 0);
SetGoalFlags(player, 0, 2);
SetGoalFlags(player, 1, 1);
done0 = 1;
Return;
}
// Goal: 2
if((!done2) && (GetSenderRef() == surfaceGoal2))
{
jkPrintUNIString(player, 350);
PlaySoundThing(soundGoal2, player, 1.0, -1, -1, 0);
SetGoalFlags(player, 2, 2);
done2 = 1;
Sleep(3);
jkEndLevel(1);
Return;
}

Return;

touched:
// Goal: 1
if((!done1) && (GetSenderRef() == thingGoal1))
{
jkPrintUNIString(player, 350);
PlaySoundThing(soundGoal1, player, 1.0, -1, -1, 0);
SetGoalFlags(player, 1, 2);
SetGoalFlags(player, 2, 1);
done1 = 1;
Return;
}

Return;

end
2001-05-11, 3:13 PM #2
The cog looks like it should work ok. One thing I would try is to remove these two lines in the startup section:
// SetGoalFlags(player, 1, 1); // Not visible at startup
// SetGoalFlags(player, 2, 1); // Not visible at startup
I have a feeling that if you start a line in the code with "//" it doesn't always ignore it. I would remove those lines, but if you want to keep those lines for your own reference then use "#" at the start of the line instead.

One simplification is to use "sound soundGoal=accomplish1.wav local" in the symbols section and simply use "soundGoal" for all three goals - since it's the same sound.



------------------
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2001-05-11, 4:17 PM #3
Yes, it does always ignore it. That's the whole point..

------------------
Together we stand.
Divided we fall.

↑ Up to the top!