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 → Simple Cog Won't Work...
Simple Cog Won't Work...
2001-09-17, 4:01 PM #1
Trying to learn cog for a project I'm working on. Please some help on why this won't work! I added it to placed cogs, start up the level, and nothing prints to the screen.
Code:
// Jedi Knight Cog Script
// Author: Brian Lozier (brian@massassi.net)
// ======================================================================================

// flags=0x40

symbols

	message		startup
	message		pulse

	int			player			local
	int			pulse_count=0	local

end

// ======================================================================================

code

// ------------------------------------
	startup:
		player = GetLocalPlayerThing();
		SetPulse(1);
		Print("Welcome to Jedi Knight");
	return;

// ------------------------------------
	pulse:
		JkStringClear();
		JkStringConcatAsciiString("Pulse #: ");
		JkStringConcatInt(pulse_count);
		JkStringOutput(-3, -1);

		pulse_count = pulse_count + 1;
	return;

end

// ======================================================================================
2001-09-17, 4:20 PM #2
You cog eh?
php - delphi - and now cog, welcome, you probably get more help than delphi [http://forums.massassi.net/html/smile.gif]

The startup message of JK gets executed just a second before your screen enters inside the level, that's why you don't see it printed out.

In order for that to show on startup, place this before the print command.

Sleep(2);

That should do, or you can try a little lower like 1.5 as you like.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited September 17, 2001).]
2001-09-17, 4:31 PM #3
But even if I miss that, shouldn't it print out the pulse messages every second?
2001-09-17, 7:16 PM #4
If your cog does not print anything at startup after you placed some "sleep()", that means that the whole cog is not functioning, which I guess is that the cog is not registered properly.

One thing you can do is to check if the cog is really registered properly in JED or not.

Another thing probably doesn't have much possibility of fixing but, try to comment your words above the code section with "#"s.

Other than that I see nothing is wrong.

------------------
http://millennium.massassi.net/ - Millennium
2001-09-17, 7:45 PM #5
Thanks. I don't think I installed it properly... or something. I put it in my project directory under the /cog/ directory, then I did F7 (placed cogs) and did add cog. Since there is nothing to change in Jed, I just saved, then played, but it won't work [http://forums.massassi.net/html/frown.gif]
2001-09-17, 7:50 PM #6
Argh, I changed it to setpulse(1.0) from setpulse(1) and it worked... stupid!
2001-09-18, 12:48 AM #7
That was nuts. Never seen such an error was in JK engine.

------------------
http://millennium.massassi.net/ - Millennium
2001-09-20, 12:36 PM #8
I always thought you had to use '#' in the messages section. I guess that doesn't make any difference, huh.

-Tazz

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2001-09-20, 1:21 PM #9
Nope, no difference between "#" and "//".

BTW, there's nothing wrong with a pulse of "1.0". I just tested a 1.0 pulse and it worked like normal.

------------------
Fiction must be more realistic than truth or no one will believe it.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-09-20, 3:14 PM #10
Screwy JK!

------------------
http://millennium.massassi.net/ - Millennium

↑ Up to the top!