Bandicoot 0 Posted September 19, 2008 Hi, I'm using a random code gen from Codepad by Blanco(Modified by - RickUK 2007-01-04) for missions involving getting a code off dead bodies or speak to someone, but what I'm having issues is that the setup in MP mode doesn't let everyone have the same code. Â I've tried just the DedicServer to create the code, but how can I transfer the same code to the other clients. Â Can anyone see what the problem is? ie- <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Init Codereadycheck=false;Publicvariable "Codereadycheck" codefound = false Ncode1 =[] MAXNR = 6 ;If client goto #start and wait for server to create code ?!(local server): goto "Start" #Create_random_digit _digits = ["1","2","3","4","5","6"," ;7","8","9","0","",""] _countdigits = count _digits _code = "" _i = 0 #CYCLE _r = random _countdigits _r = _r - _r % 1 _digit = _digits select _r ; You can't put special characters in a string for some reason..., Even between double qoutes.I had to find an alternative,it works great! ? _r == 10 : _digit = "#" ? _r == 11 : _digit = "*" _code = _code + format ["%1",_digit] _i = _i + 1 ?_i < MAXNR : goto "CYCLE" Ncode1 = _code; Publicvariable "Ncode1" ~1 Codereadycheck=true;Publicvariable "Codereadycheck" #Start ;clients wait for server to create code @Codereadycheck ~1 hint format["%1",Ncode1] [code_pad,Ncode1] exec "\TEFextras\codepad\pad\numpad.sqs" ;?(Randomunits):[Codekeeper] exec "\TEFextras\codepad\pad\randomassign.sqs";exit [Codekeeper] exec "\TEFextras\codepad\pad\bodysearch.sqs" exit I endup getting the scalar error msg, meaning the clients didn't get the code I assume. Should I be using a code that is more numeric rather than string format to make the info more of a publicvariable or is that barking up the wrong tree? Regards, Bandicoot Share this post Link to post Share on other sites
poweruser 10 Posted September 20, 2008 Broadcasting Strings via publicVariable isnt supported in Ofp, it is since ArmA v1.00 If you still want it to be a String, try this script: OFP : MISSION EDITING & SCRIPTING >> addAction play sound for all ? 3rd post Share this post Link to post Share on other sites
Bandicoot 0 Posted September 20, 2008 Hi, I tested the Publiccode.sqs,  found that the information  it sends is like setting up a trigger, you can't send Local variable. [{Ncode1 = _code}] exec "publicCode.sqs" This is what is sent and read: Ncode1 = _code So I'm trying to send what is in the variable Ncode1 to update all clients verison of Ncode1. I see what its doing in that all clients create a unit with the init details, but its not displaying in the init what the variable equals. Unless format ["%1", _Code], but then wouldn't it just say that instead of having the logic to display whats within the variable? Regards, Bandicoot Share this post Link to post Share on other sites
poweruser 10 Posted September 20, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call format [{ [{Ncode1 = ""%1""}] exec {publicCode.sqs}}, _code]; This format-construct will make sure that the variable '_code' is evaluated first, before the message is send. Share this post Link to post Share on other sites
Pulverizer 1 Posted September 20, 2008 Yeah, you can send pretty much anything. It's a matter of getting the syntax right. This doesn't work because the local variable doesn't exist outside of the particular instance of the script on this particular machine: _myRnd = random 1 {globalRand=_myRnd} call pub You have to convert the value into the code string so it becames something like this: {globalRand=0.564717} call pub Share this post Link to post Share on other sites
Bandicoot 0 Posted September 20, 2008 Thanks dengibtsschon. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> call format [{ [{Ncode1 = ""%1""}] exec {publicCode.sqs}}, _code]; This did the trick The "call format" to exec the publicCode was the solution for this script. Â Thank you Pulverizer for your script "publicCode.sqs". Trying to keep the old OFP girl alive. Â Regards, Bandicoot Share this post Link to post Share on other sites