Home   Help Search Login Register  

Author Topic: call Format & publicVariable mixed ?  (Read 477 times)

0 Members and 1 Guest are viewing this topic.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
call Format & publicVariable mixed ?
« on: 10 Aug 2003, 15:22:08 »
HI there.

I'm scripting a MP C&H scenario with lots of flags to conquer.

The Server manages the status of the flags and needs to tell the clients the latest info. 1 script runs for 1 flag, with the number of the flag as a parameter.

Problem is: when writing the flagscript you dunno what number this script gets at runtime.

Therefore you need to script in a way that every number produces valid code. Like this:

?(_trigger_nr == 1):publicVariable "side_1"
?(_trigger_nr == 2):publicVariable "side_2"
?(_trigger_nr == 3):publicVariable "side_3"
?(_trigger_nr == 4):publicVariable "side_4"
?(_trigger_nr == 5):publicVariable "side_5"
?(_trigger_nr == 6):publicVariable "side_6"
?(_trigger_nr == 7):publicVariable "side_7"

However, it could be replaced with this much better code:

call format[{publicVariable "side_%1"},_trigger_nr]


Problem is: it produces no errors, but i dunno if it would work over a real network (LAN). Has somebody experiences with this situtation ? Or could test it ?

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:call Format & publicVariable mixed ?
« Reply #1 on: 14 Aug 2003, 23:41:28 »
That is EXACTLY what I do in my map http://home.earthlink.net/~dbircsak/ofp/ch24liberate.abel.zip.  You will need to extract the pbo to see the files.  I have a flags.sqs (server side) and takeflag.sqs (client side).  One script runs on client & one on the server to handle all C&H flags on the map.

Doolittle

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:call Format & publicVariable mixed ?
« Reply #2 on: 15 Aug 2003, 01:19:23 »
confirmed.  I do this stuff on a large scale.
Dinger/Cfit

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:call Format & publicVariable mixed ?
« Reply #3 on: 15 Aug 2003, 01:24:15 »
Thx guys. I DLed & will look into it.