Home   Help Search Login Register  

Author Topic: "Server-side Loops and Messages"-tutorial by Tactician.  (Read 689 times)

0 Members and 1 Guest are viewing this topic.

Rodd

  • Guest
A very good explanation of the publicVariable function in the serverloop.sqs/showscore.sqs-example; thank you Tactician.
In the example the reserved word Score is used as a variable, OFP is not too pleased about that, but np though I just rename it to ScoreVal and it works fine!
The
Quote
If the mission is run on a dedicated server, ScoreMsg will remain true but only on the server ...
is actually not entirely accurate (as far as I can tell (ver. 1.46)); "init.sqs" will execute "showscore.sqs" on the server and consequently ScoreMsg will be reset for the server as well - dedicated or not.

Rubble_Maker

  • Guest
Re:"Server-side Loops and Messages"-tutorial by Tactician.
« Reply #1 on: 20 Aug 2003, 20:30:36 »
Yes its a very nice tutorial indeed, but the idea behind it does not only apply to distributing score values. It can also be used to trigger any sort of event across the network. The "trick" to make this work is to have a script run on all machines which listens for a certain publicVariable. When it receives a value/command it resets the variable, *but only locally*! That is, it resets it only on the local machine, and not in the entire network (as it'd do if the value was PV'ed after the reset). After the reset, only a PV from another client will change the value of the variable, so that the next value/command can be received. Using this trick one can replicate local events on all network nodes with very little scripting effort.

I hope this makes sense; its the core of this tutorial really.