Home   Help Search Login Register  

Author Topic: publicvariable  (Read 1736 times)

0 Members and 1 Guest are viewing this topic.

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
publicvariable
« on: 06 Aug 2006, 16:50:12 »
I've got a quite big problem here :-\ I've got a lot of information that's locally, and I need it to be global. Problem is, it seems I can't PV it, not with publicvariable nor CoC NS publicvariable of arrays. First of all, I need a way to PV strings. Second, I need some way to PV random codes/commands. One example of what I need to PV:

Code: [Select]
_script = (_z = (vehicle leader (_this select 0)); player reveal _z; player dofire _z)
I need some way to transfer that information from one client to all others.
« Last Edit: 06 Aug 2006, 17:17:15 by Garcia »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: publicvariable
« Reply #1 on: 07 Aug 2006, 01:58:03 »
coc_ns for pv'ing strings uses
fnsendall

remotecall may be of use too


unfortunately the online docs manual server is down at the moment

what you could do is remote start a function, passing variables to the function

[[_a, _b, _c,_d,_e],"TxU_myfunction"] call fNSendAll

then have the function start a script up, passing those elements to the script

TxU_MyFunction
[_a, _b, _c,_d,_e] exec "myscript.sqs";


myscript.sqs
goto _this select 0

#1
(_this select 1)moveindriver (_this select 2)
exit

#2
(this select 1) join (group _this select 2)
exit



hope that helps
« Last Edit: 07 Aug 2006, 02:10:44 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re: publicvariable
« Reply #2 on: 07 Aug 2006, 16:21:30 »
I may have found a workaround for the 2 biggest problems ATM, but thanks, this information will probably come in handy later on.

Now, I do have another problem. I've got an array with lots of information that I PV using CoC NS 2.0.

Code: [Select]
hs_cmd_que_pass = hs_cmd_que_pass + [[_shouting,player,_sign,_heard,_range,_sqd,_dir,_teams,_extra,_script]]
"hs_cmd_que_pass" call fPublicArray

This happens on my client. When I test it in singleplayer it all works good, but when I try it on a dedicated server, I run into a strange problem. In another script I have a check to prevent the script from moving on when there is nothing on the array. The check is this:

Code: [Select]
@ ((count hs_cmd_que_pass) > 0)
I know that it works, because it works when I play in singleplayer, and it works on my client in multiplayer. However, the server don't go past that point until there are 2 element in the array, not when there is only one. So I wondered if the server doesn't get the information the first time, so what I did was something like this:

I added the information in the hs_cmd_que_pass array to another array, only on the server, then I PVed the second array with NS 2.0, and had a script running on my client where all the information in the second array popped up. Something like this:

Code: [Select]
? (local server) : arrayname = hs_cmd_que_pass
? (local server) : "arrayname" call fPublicArray

then in another script I had this:

Code: [Select]
#loop
hint format ["%1",arrayname]
~3
goto "loop"

Note that all this is being written by memory, so any typos wasn't there. It all worked the way it was supposed to, because all the information that was passed on to my client from the server in the new array was there. I also used tried getting the server to extract the information from the array, but it didn't get any of it. Somehow the server is able to pass on the information in another array, but at the same time it's not able to notice that the array contains anything :-\ So basically, if the server refuses to notice the information in the array, the whole idea goes to hell, and I have to figure out another system where I probably will end up having to use only the "normal" PV command. But if anyone got any ideas on how to fix this, then I'd be happy ;)

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: publicvariable
« Reply #3 on: 07 Aug 2006, 19:07:08 »
this is an odd one, not heard of this.
I have only ever used fpublicarray once and used it in the following way

1) I declared my array as empty in the Init.sqs
2) Populated my array on the server only
3) and then sent it to all clients

A few questions,
did you add the array variable name to CoC_PublicArrays
eg
CoC_PublicArrays    = ["ArrayA", "ArrayB"]

if so when?

and did you call fpublicarray before (CoC_ClientsReady)  or after ?

if this hasnt helped, what you could try is the following on the receiving nodes


Quote
#INIT
_temp = hs_cmd_que_pass
#LOOP
@ ! _temp == hs_cmd_que_pass
_temp = hs_cmd_que_pass
hs_cmd_que_pass = _temp
?(local server):(using fnprint, send a message back to client that server has been updated)
goto "LOOP"

NB>> I'm not too sure how to correctly use fnprint, and again, the online docs, which are cryptic enough anyway, are down
« Last Edit: 08 Aug 2006, 00:01:13 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re: publicvariable
« Reply #4 on: 07 Aug 2006, 19:27:14 »
I did set it up right, with CoC_PublicArrays set up before the @CoC_clientsready, and I set the arrays to empty in the init before I did the CoC_PublicArrays thingy :-\ But I've pretty much found a suitable workaround now, however, it means a lot more scripting and shit than I would have had to do if I could get the PV of arrays to work properly :-\ I think I'll try to finish it the way I'm doing now, and then maybe have a look at the array PV.