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 → Grrr... Coging issue.
Grrr... Coging issue.
2004-02-24, 2:03 PM #1
Ok.. I decided to get into cogging, to start makeing things that I want in my level, to do.. Only problem is, I've just recently started cogging, and I'm kinda having trouble. Though, I now basic C programing, so its practicly second nature.. ^_^..


Anyway.. Heres the problem.. I'm making a cog that moves a 'thing' from multible frames. (10). I made the frames in jed, but the cog just doesnt seem to work. Heres the script.


Code:
symbols
	message	startup
	message	entered

	thing		hovercraft
	flex		MoveSpeed=1.0
	sound		Hover Sound=""

end

#...................................................................................................

code
entered:

	MoveToFrame(hovercraft, 0, movespeed);
	MoveToFrame(hovercraft, 1, movespeed);
	MoveToFrame(hovercraft, 2, movespeed);
	MoveToFrame(hovercraft, 3, movespeed);
	MoveToFrame(hovercraft, 4, movespeed);
	MoveToFrame(hovercraft, 5, movespeed);
	MoveToFrame(hovercraft, 6, movespeed);
	MoveToFrame(hovercraft, 7, movespeed);
	MoveToFrame(hovercraft, 8, movespeed);
	MoveToFrame(hovercraft, 9, movespeed);

end

#...................................................................................................



I need any feedback on this problem.. PLEASE help.. ^_^// Thanks.


[Code tags, not quotes... [img]http://forums.massassi.net/html/wink.gif[/img]]

[This message has been edited by GBK (edited February 24, 2004).]
"Greetings young Padawan."
2004-02-24, 2:22 PM #2
You have to specify a sector that you enter like this, and you probably need to change that Hover Sound to Hover_Sound so there are no spaces. Also, i dont see why you need that message startup, and you forgot to put the return;


Code:
symbols

message entered

sector theSector
thing hovercraft
flex MoveSpeed=1.0
sound Hover_Sound=putsoundhere.wav

end

#...................................................................................................

code
entered:

MoveToFrame(hovercraft, 0, movespeed);
MoveToFrame(hovercraft, 1, movespeed);
MoveToFrame(hovercraft, 2, movespeed);
MoveToFrame(hovercraft, 3, movespeed);
MoveToFrame(hovercraft, 4, movespeed);
MoveToFrame(hovercraft, 5, movespeed);
MoveToFrame(hovercraft, 6, movespeed);
MoveToFrame(hovercraft, 7, movespeed);
MoveToFrame(hovercraft, 8, movespeed);
MoveToFrame(hovercraft, 9, movespeed);

return;

end

#...................................................................................................


I hope this helps [http://forums.massassi.net/html/smile.gif]

------------------
"The quality of the levels you make is determined by the skill of the person not by the editor in which they use!"
-Michael Kyle

The Arcane Sith
2004-02-24, 4:05 PM #3
Code:
symbols
message	entered
Sector EnterSector
thing hovercraft
flex MoveSpeed=1.0
end
code
entered:
	MoveToFrame(hovercraft, 9, movespeed);
	Stop;
end


You made a few common errors...

1) There is no need to specify every frame to move to, just the last one. Trust me on this.

2) You used the Entered message, but you failed to specify what should trigger that message.

3) The whole 'Hover Sound=""' thing. That will kill the cog. Do *not* use quotes when specifying a sound, and certainly dont leave empty sound variables in there...

4) You forgot to add a Return; or Stop; at the end of the message. This wouldnt have been fatal, but its always nice for the clean code aspect.

5) You had a message in the symbols that was unused. This too is not fatal, but its sloppy. If a symbol is unused, remove it or comment it out.

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-02-24, 4:21 PM #4
If you don't put a return; at the end of the message, it'll call everything below it.
2004-02-24, 4:57 PM #5
Quote:
<font face="Verdana, Arial" size="2">Posted by GBK:
1) There is no need to specify every frame to move to, just the last one. Trust me on this.

2) You used the Entered message, but you failed to specify what should trigger that message.

3) The whole 'Hover Sound=""' thing. That will kill the cog. Do *not* use quotes when specifying a sound, and certainly dont leave empty sound variables in there...

4) You forgot to add a Return; or Stop; at the end of the message. This wouldnt have been fatal, but its always nice for the clean code aspect.

5) You had a message in the symbols that was unused. This too is not fatal, but its sloppy. If a symbol is unused, remove it or comment it out.
</font>



Ooh, I learn something new every day [http://forums.massassi.net/html/smile.gif].

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited February 24, 2004).]
May the mass times acceleration be with you.
2004-02-24, 9:08 PM #6
MysteriousSith, you forgot something. WaitForStop(). Without that, the thing would probebly go all nuts! But yes, one MoveToFrame() would do. And the sound is unused! You should get a few tools... DataMaster for information about the different verbs, and Parsec for error checking.

[edit]You can use Entered to check if you have landed on the thing. But then you'll need a thing like:
If(GetSenderRef()!=hovercraft) return;
If( thing sending message is not hovercraft ) Don't continue.

/Edward


[This message has been edited by Edward (edited February 25, 2004).]
Edward's Cognative Hazards
2004-02-25, 3:43 AM #7
Thanks a lot for the help people, But, I got it working last night.. I still have one small question to ask..


Code:
# Jedi Knight Cog Script
#
# Wandercog.COG
#
# Move thing to multible frames
# until its deactivated.
# (You must have a min. of 10 frames
# for this cog to work properly)
#
# © Jedi_Nenshou_ (Chris DeVore)
# ..................................................................................................
#
flag=0x100
symbols
	message	startup
	message	arrived

	thing		hovercraft
	flex		MoveSpeed=1.0
	sound		HoverSound
	flex		Volume=.5

	int	dummy	local

end

# ...................................................................................................

code
arrived:
	StopSound(dummy, 1.0);
startup:
	dummy = PlaySoundThing(hoversound, hovercraft, volume, 10, 10, 0x1081);
	 MoveToFrame(hovercraft, 9, movespeed);
	return;

end

# ...................................................................................................


My question is, how do I get the cog to repeat itself, over and over? Like... ReturnEX command? I dunno.. -_-...

Thanks for the help, and I didnt know that about the last frame thing.. Thanks.. ^_^
"Greetings young Padawan."
2004-02-25, 3:45 AM #8
One more thing to add to up there, is that the sound isnt working right.. it doesnt play while the thing is moving, but it plays when it stops.. Which is the OPPOSITE of what I want it to do.. -_-..
"Greetings young Padawan."
2004-02-25, 3:53 AM #9
You can bind the sound to the thing via a .snd file. Check out some elevator examples to see how it works.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-02-25, 4:33 AM #10
To get things to repeat over and over, depending on the individual case you can either use "timers" or a "pulse" message. Make no mistake, both of methods are useful but for very different reasons - it depends entirely on the effect that you're after...

Also as zagibu mentions, you can attach a soundclass to a thing (or modify it from within cog with the "ParseArg()" verb...)

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-02-25, 6:41 AM #11
Code:
# Jedi Knight Cog Script
#
# Wandercog.COG
#
# Move thing to multible frames
# until its deactivated.
# (You must have a min. of 10 frames
# for this cog to work properly)
#
# © Jedi_Nenshou_ (Chris DeVore) (Fixed by gbk, 2/25/04)
flag=0x100
symbols
	message	startup
	message	arrived

thing hovercraft
flex MoveSpeed=1.0
sound HoverSound
flex Volume=.5

int dummy local

end

code
arrived:
	#StopSound(dummy, 1.0);
	If(GetCurFrame(hovercraft) == 9) MoveToFrame(hovercraft, 0, MoveSpeed);
	else MoveToFrame(hovercraft, 9, MoveSpeed);
	Stop;

startup:
	dummy = PlaySoundThing(hoversound, hovercraft, volume, 0, 100, 0x81);
	MoveToFrame(hovercraft, 9, movespeed);
	return;
end



The sound problably worked in your cog, you just couldnt hear it.

The last bits of the PlaySound verb, which were "10", "10", and "0x1081" in yours, are the Minimum Radius, Maximum Radius, and the Play Flags. Basically, you set it to loop forever and move with the thing (you didnt need 0x1000). The flags would have been ok, but the min and max radiuses were the same..... So, the sound was never heard. USe 0 as the Min radius, and something like 100 for the max. COntrary to popular belief, these mesurements are NOT in JKUs....

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-02-25, 8:20 AM #12
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Edward:
MysteriousSith, you forgot something. WaitForStop().</font>


I hardly ever use it and things always work out fine, but there are a few situations where i do need to.



------------------
"The quality of the levels you make is determined by the skill of the person not by the editor in which they use!"
-Michael Kyle

The Arcane Sith
2004-02-26, 3:12 AM #13
GBK, your COG would make the thing move back and forth, and not around in a loop. To do so, you'd need something like:
arrived:
If(GetCurFrame(thing)==9)
{
SkipToFrame(thing,0,100);
WaitForStop(thing);
MoveToFrame(thing,9,speed);
}

/Edward

[This message has been edited by Edward (edited February 26, 2004).]
Edward's Cognative Hazards
2004-02-26, 5:03 AM #14
Hi there [http://forums.massassi.net/html/smile.gif]

Although I can't check right at the moment, I think you may be wrong there Edward - remember the "arrived" message is called every time the "thing" object arrives at one of its pre-assigned frames.

Thus going by this logic (and GBK's code) the "arrived" message is called on each frame and once the frame equals the last frame, then it moves the object back to frame 0... But this is only clarifying the point of GBK's code - he's been around cogging a heck of a lot longer than me [http://forums.massassi.net/html/wink.gif] (just how much longer though? When did you start cogging GBK? Just out of curiosity [http://forums.massassi.net/html/smile.gif])

Hope this has helped clear up any confusion [http://forums.massassi.net/html/biggrin.gif]

-Jackpot


[EDIT]
Wow [http://forums.massassi.net/html/eek.gif] Just checked and found that I joined less than a month after GBK. And he has that many posts. Now I feel bad - I haven't dedicated enough of my life to Massassi [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]
[/EDIT]

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

[This message has been edited by lucky_jackpot (edited February 26, 2004).]
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-02-26, 6:10 AM #15
Nenshou, please explain EXACTALLY the kind of behaviour you want out of this cog.


Quote:
<font face="Verdana, Arial" size="2">Originally posted by lucky_jackpot:
...When did you start cogging GBK? Just out of curiosity [http://forums.massassi.net/html/smile.gif]</font>


About ~1.5 years before I joined Massassi. So, somewhere around 4 years. Geeze, has it been that long? [http://forums.massassi.net/html/frown.gif]

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-02-27, 3:09 AM #16
Oh, yeah... GBKs COG was OK, apart from one thing. Replace the MoveToFrame(0 to SkipToFrame(0. Otherwise it will go back and forth instead of around in a loop.

/Edward
Edward's Cognative Hazards

↑ Up to the top!