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 → Server/Client Problems...
Server/Client Problems...
2003-08-01, 1:26 AM #1
Hi!
I finally got "permition" to take my computer and put it next to another to try out my multi player levels. Then I found some BIG problems... I fixed a few camera problems like adding the COG flags=0x240. And I did this too all COGs where only the Server got the message and not the client... But now I've come across something very wierd...
ThingLight!
When I press a switch, only the server sees the light turn on. I tried different flags but same result (apart from 240, there only the presser saw the light). How do I do so that anyone sees the light when anyone presses the switch?
Code:
# Press Control panel to activate lights att full!
#
# By Edward
symbols
message	startup
message	activated
thing		controlpannel
thing		light
flex		amount
int		on=0	local
sound		lighton
sound		lightoff
end
code
startup:
	thinglight(light,0,0.0);
return;
activated:
	If(GetSenderRef()!=controlpannel) Return;
	If(on==0)
	{
		PlaySoundThing(lighton,controlpannel,1,1,100,0xC0);
		on=1;
		thinglight(light,amount,0.0);
	}
	else
	{
		PlaySoundThing(lightoff,controlpannel,1,1,100,0xC0);
		on=0;
		thinglight(light,0,0.0);
	}
Return;
end

/Edward
Edward's Cognative Hazards
2003-08-01, 8:59 AM #2
Cog flags 0x200 is local. This means only the person activating it will see it becuz..... its local. Try making the light in a unlocal cog and using sendmessage to a local cog where you have the camera focus.
2003-08-01, 9:38 AM #3
Isn't what I have? An unlocal COG?
And I've fixed the cameras!

/Edward
Edward's Cognative Hazards
2003-08-01, 10:35 AM #4
Quote:
<font face="Verdana, Arial" size="2"> And I did this too all COGs where only the Server got the message and not the client...</font>

Quote:
<font face="Verdana, Arial" size="2">Cog flags 0x200 is local. This means only the person activating it will see it becuz..... its local.</font>


Both wrong. Use the DM before posting, and before answering. You could have easily looked that up in the DM's section on Cog Flags. [http://forums.massassi.net/html/rolleyes.gif]

But what is your problem. You've fixed your camera, but this cog looks like it should work - why do you want to add flags to it?

I see you're probably new here, Theares, but read the Forum Policy thread, and be sure to check with the DM if your answer can be checked against a reference.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-01, 1:05 PM #5
Well, the problem is:
When anyone presses the button, Only the server sees the light turn on.
Edward's Cognative Hazards
2003-08-01, 4:36 PM #6
But everyone hears the sound? Because if they do, then ThingLight() isn't syncing (as it may not). If they don't hear the sound, it's your cog. And since a level cog without extra flags runs on the server and syncs events, I doubt that.

Now if it's the verb, here's what you need to do. Add the trigger message to your cog; Use SendTrigger() in the on and off code to send a different trigger for each; In your trigger message, use SetThingLight() to turn the light on or off depending on the trigger's ID. No need to put the sound in the trigger message because we know that will sync.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-02, 12:24 AM #7
OK, both Client and Server hears the sound and only server sees the light... Shoot... OF COURSE THEY HEAR THE SOUND! THE MAX DISTANCE IS ENSEMOUNTABLE!!! I'll change it to -1,10...
OK, only he who is within 1m hears the sound, but it is still only the server that sees the light...

/Edward
Edward's Cognative Hazards
2003-08-02, 3:01 AM #8
at massassi's cog section you will find the cog you want, i edited it a bit for AJTD but heres the cog.
Code:
# Jedi Knight Cog Script
#
# lightswitch.cog
#  
# [EH_AceCSF]
#
# This COG is NOT supported by LucasArts Entertainment Company

symbols
	message		startup
	message		activated

	thing			Light0		nolink
	thing			Light1		nolink
	surface		swith0		linkid=0
	surface		swith1		linkid=0
        int             startlight=1.0
        int             on=0 local
	sound		activ
	sound		deactiv
end

code
startup:
	SetThingLight(Light0, 0.0, 0.0);
	SetThingLight(Light1, 0.0, 0.0);
	return;

activated:
if ((GetSenderID() == 0) && (on == 1))
{
	playsoundlocal(activ, 1, 0, 132);
	SetThingLight(Light0, 0.0, 0.0);
	SetThingLight(Light1, 0.0, 0.0);
	on=0;
}
else
{
	playsoundlocal(deactiv, 1, 0, 132);
	SetThingLight(Light0, startlight, 0.0);
	SetThingLight(Light1, startlight, 0.0);
	on=1;
}
	return;
end


(did i own again??)

------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-08-02, 4:01 AM #9
Sorry, but I see no difference in the code apart from the SETthinglight and linkid and 2 lights instead of one and GetSenderID instead of Ref...
How does this sync the clients for lights...

[This message has been edited by Edward (edited August 02, 2003).]
Edward's Cognative Hazards
2003-08-03, 4:14 PM #10
Quote:
<font face="Verdana, Arial" size="2">OK, both Client and Server hears the sound and only server sees the light... Shoot... OF COURSE THEY HEAR THE SOUND! THE MAX DISTANCE IS ENSEMOUNTABLE!!! I'll change it to -1,10...
OK, only he who is within 1m hears the sound, but it is still only the server that sees the light...</font>


Look, you don't know a **** thing about what you're doing. If I ask you a question nicely, I expect a courteous answer. I can't see any reason for your attitude, but don't give anyone else who tries to help you that kind of crap again.

The fact that everyone hears the sound means that your cog has the correct flags and is working as intended, but the verb is not syncing. So you'll need to write out the SendTrigger() system...



------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-03, 10:55 PM #11
Sorry for the Capitals... But the yelling was at me, me feeling silly to not notice the distance problem.
Any way, I will try the trigger... Hang on... What should I put in the SendTrigger()?

/Edward

[This message has been edited by Edward (edited August 04, 2003).]
Edward's Cognative Hazards
2003-08-05, 1:49 PM #12
Hello? What should be in SendTrigger()?
Edward's Cognative Hazards
2003-08-05, 3:51 PM #13
Code:
activated:
     //-Send the ACT_TRIG with ON as Param(0)...
     SendTrigger(-1, act_trig, on, 0, 0, 0);
return;
#----------
trigger:
     //-Make sure that its the right trigger...
     if(GetSourceRef() != act_trig)
          return;
     //-Get the Param(0)...
     on = GetParam(0);
     //-If ON = 0, turn the light on...
     if(on == 0)
          {
          on = 1;
          PlaySoundThing(lighton, controlpannel, 1.0, -1, -1, 0xC0);
          ThingLight(light, amount, 0.0);
          return;
          }
     //-Otherwise turn the light off...
     on = 0;
     PlaySoundThing(lightoff, controlpannel, 1.0, -1, -1, 0xC0);
     ThingLight(light, 0.0, 0.0);
return;

try adding that, or something like it. also put flags=0x240 above 'symbols' and message trigger and int act_trig in the symbols section.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited August 05, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-08-05, 6:45 PM #14
Two things with that trigger cog:

[edit] it works, so [http://forums.massassi.net/html/smile.gif]

Second, why bother sending the trigger if on equals one?

But anyway, good of you to write out the cog, DeathSythe. [http://forums.massassi.net/html/wink.gif] For myself, I'm ready to let Edward do the research and try himself to do what he wants.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited August 06, 2003).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-05, 11:37 PM #15
THANK YOU, DSLS_DeathSythe!
It worked... Both Server and Client sees the light! And I'm sticking to flags=0x40

Now... On to the next problem...
Edward's Cognative Hazards

↑ Up to the top!