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 → A problem...
A problem...
2005-03-20, 3:48 PM #1
Hi!
A problem, or 2, or thousand...
I have made this COG where a door is locked unless you can type in the right code. Problem is that, the code that is displayed in the other room does not seem to match what I type in! Yet, in the print test it is 100% matching.

Problem 2 is that I want this code to be secretive until the release of my level. So... Who can I trust to look, help, then remove and forget?

/Edward
Edward's Cognative Hazards
2005-03-21, 1:22 AM #2
Have you tried another code?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-03-21, 3:04 AM #3
Have tried lots of different codes.
Thing is that the code isn't really preset. At startup: I give a random 8 digit number. Random numbers so people can't cheat and not go to "this" room.
Edward's Cognative Hazards
2005-03-21, 4:57 AM #4
Post your display code...
And when the moment is right, I'm gonna fly a kite.
2005-03-21, 5:16 AM #5
My display code?
You mean the random numbers? Or where they are displayed? Or what is being displayed on the code machine?
I'll display something:

Code:
startup:
	sleep(rand());
	for(i=0; i<8; i=i+1)
	{
		SetWallCel(type0,10);
		num0=rand()*9;
		SetWallCel(find0,num0);
		sleep(rand());
	}
return;

OK... That is as much as I can display without giving away stuff... If it ain't enough, then I'll have to trust someone.

/Edward
Edward's Cognative Hazards
2005-03-22, 3:52 AM #6
OK... I can give one other piece of code...
Code:
			player=GetSourceRef();
			if(GetWallCel(type0)==num0 && GetWallCel(type1)==num1 && GetWallCel(type2)==num2 && GetWallCel(type3)==num3 && GetWallCel(type4)==num4 && GetWallCel(type5)==num5 && GetWallCel(type6)==num6 && GetWallCel(type7)==num7)
			{
				PlaySoundPos(correct, GetSurfaceCenter(type7), 1, -1, -1, 0x0);
				MoveToFrame(door, 1, 4);
			}
			call offline;
Edward's Cognative Hazards
2005-03-22, 7:55 AM #7
rip the cog out from the new empire by chris swan wich makes the same
SpriteMod (JO 2003) Roger Wilco Skin

Snail racing: (500 posts per line) ---@%
2005-03-22, 11:03 AM #8
Quote:
Originally posted by G-Man
rip the cog out from the new empire by chris swan wich makes the same

=§ Eeehh.... I can't believe what the HELL I'm seeing!!! THREE COGS! FOR ONE SECURE DOOR!!! I think I'm gonna pass out...
Anyway, I found the resulting COG, and I see it has brackets around each number, so I did so and nothing changed.
Oh, and also, I can't really use this COG even if I merge the 3 together. I'm using a completely different technik.

Can you keep a secret? If you can, post your Email... I'm afraid I might have lost it...

/Edward
Edward's Cognative Hazards
2005-03-25, 2:09 AM #9
So, who can keep a big secret? The one who can, post your Email and say YES!

/Edward
Edward's Cognative Hazards
2005-03-25, 3:30 AM #10
What's printed when you add this code in your second cog section just above the if clause:
Code:
for(i=0;i<8;i=i+1)
{
 PrintInt(GetWallCell(type0));
 PrintInt(num0);
 Sleep(3);
}

It should print a matching pair of numbers all 3 seconds...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-03-25, 4:09 AM #11
EXACT MATCH! Yet, door won't open...

And you spelled the celllllls wrong.
Edward's Cognative Hazards
2005-03-26, 12:16 AM #12
I can keep a secret, but it may take a while for me to get back to you. lumpshare@yahoo.com
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2005-03-26, 5:56 AM #13
Strange...try enclosing each comparison with brackets, like this:
Code:
if((GetWallCel(type0) == num0) && (GetWallCel(type1) == num1) ...etc.)

Might be an operator hierarchy problem...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-03-26, 7:39 AM #14
I did that five posts ago!

Anyway, I have entrusted SG-fan with the holy secret code, and he will be working on it. Anyone who DARES bug him will be automaticly banned until I submit a level to Massassi. Thank you.

/Edward
Edward's Cognative Hazards
2005-03-27, 2:22 AM #15
Now that can't be. The if clause must become true, if you really have an exact match on the numbers...
Have you tried negating the if clause and seeing if it opens when the code is wrong?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-03-27, 3:16 AM #16
Still no change... Even if I added a completely different number.
Edward's Cognative Hazards
2005-03-27, 12:57 PM #17
Bingo, the problem was that the "integer" num0 wasn't actually truncating the rand()*9 value. It was leaving it as a decimal. Thus the if statement was testing if(1==1.797ect.)
I fixed it by adding a single line in the startup after the setwallcel
num0=GetWallCel(find0);
That forced the proper truncation without worries of integers rounding up instead of down.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2005-03-27, 1:15 PM #18
Thank you very much! Now you must delete and forget! I've sent you a little prise. Hope you like!

/Edward
Edward's Cognative Hazards
2005-03-27, 3:23 PM #19
Oh well. Then it's the PrintInt that made the conversion from decimal to integer, or else it would have displayed the difference...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-03-27, 3:37 PM #20
Actually that's it exactly. I wasn't 100% sure on the problem till I did a printflex(). In all my cogs I use printflex, I never use printint anymore since they both do the same thing, just one would show the decimals.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"

↑ Up to the top!