TolH Posted June 18, 2017 Report Share Posted June 18, 2017 Hello, Ive got a question about the epoch_message notification. I really like the notification epoch uses and wanted to add it to my mission to notify player but i am having format problem. this is what i did: Client: //"Epoch_Message1" "Epoch_Message1" addPublicVariableEventHandler { private ["_Epoch_msg"]; _Epoch_msg = _this select 1; [_Epoch_msg, 10] call Epoch_message; }; And server uses this to use it: Epoch_Message1 = ["New mission available. Check map."]; publicVariable "Epoch_Message1"; But as you can see on the picture below, the message copy the [ and the " "How can i get ride of it without breaking it. If i remove anything it doesn't work. Thanks! truemc and natoed 2 Link to comment Share on other sites More sharing options...
1 He-Man Posted June 18, 2017 Report Share Posted June 18, 2017 The "" are standard in this messages. To remove the [] try: Epoch_Message1 = "New mission available. Check map."; publicVariable "Epoch_Message1"; TolH and vbawol 2 Link to comment Share on other sites More sharing options...
1 vbawol Posted June 18, 2017 Report Share Posted June 18, 2017 Even better way is to use RemoteExec from the server, like so: ["New mission available. Check map.", 10] remoteExec ["Epoch_message",-2]; // -2 targets everyone but the server This way there are no client side changes needed. Also, this is the function:https://github.com/EpochModTeam/Epoch/blob/e16ee710ae7cd909fa4f9b1eae569a182e8cc10d/Sources/epoch_code/gui/scripts/messaging/Epoch_message.sqf TolH and He-Man 2 Link to comment Share on other sites More sharing options...
0 TolH Posted June 18, 2017 Author Report Share Posted June 18, 2017 well thanks it is working without the bracket now.. Tested it without before and it wasn't working so i wasn't sure. 18 minutes ago, He-Man said: The "" are standard in this messages. cheers! Thank you. Link to comment Share on other sites More sharing options...
0 TolH Posted June 18, 2017 Author Report Share Posted June 18, 2017 16 minutes ago, vbawol said: ["New mission available. Check map.", 10] remoteExec ["Epoch_message",-2]; // -2 targets everyone but the server yes, even better! works great. Thank you. vbawol 1 Link to comment Share on other sites More sharing options...
0 TheVampire Posted June 18, 2017 Report Share Posted June 18, 2017 In a publicVariable there are a few this values. The incoming looks like this: ["PublicVariableName",[value1,value2,etc]] So you were doing select 1 which selects the value array adding the brackets to the message. Should be (_this select 1) select 0; I see you have it solved though. vbawol and TolH 2 Link to comment Share on other sites More sharing options...
0 TolH Posted June 18, 2017 Author Report Share Posted June 18, 2017 9 hours ago, TheVampire said: ["PublicVariableName",[value1,value2,etc]] So you were doing select 1 which selects the value array adding the brackets to the message. Just so i understand for future reference, from my first exemple: Epoch_Message1 = ["New mission available. Check map."]; publicVariable "Epoch_Message1"; ^ ^ _this select 0 _this select 1 Then to remove the bracket i used this from above: Epoch_Message1 = "New mission available. Check map."; publicVariable "Epoch_Message1"; Now, let's say i want to write a text in there but add a , in the text like so : "New mission available, Check map."; now without the [] my text should only be returning "New mission available ? and not the Check map also ? I know it's newb work for you guys, but it would really great if i can get it for future things. Thanks again. Oh and almost forgot, is the epoch_message accept color code to change it and font and size ? Nevermind, found the color part , third params for epoch message. _customCol = param[2,[]]; Link to comment Share on other sites More sharing options...
0 TheVampire Posted June 18, 2017 Report Share Posted June 18, 2017 In your example you would be getting this in return: ["Epoch_Message1",["New mission availible. Check Map."]] So your selections: _var = (_this select 0); // Would Equal "Epoch_Message1" _msg = (_this select 1) select 0; // Would equal "New mission availible. Check Map." If you wanted to pass an array of strings you would have to either take the entire array and forEach it or select each element of the array for different variables. So: Epoch_Message1 = ["New mission available.","Check map."]; publicVariable "Epoch_Message1"; And then: _var = (_this select 0); // Would Equal "Epoch_Message1" _msg = (_this select 1) select 0; // Would equal "New mission availible." _msg2 = (_this select 1) select 1; // Would equal "Check map." TolH, vbawol and natoed 3 Link to comment Share on other sites More sharing options...
0 TolH Posted June 18, 2017 Author Report Share Posted June 18, 2017 _msg = (_this select 1) select 0; // Would equal "New mission availible. Check Map." Thats great, thanks alot. Actually didn't know you could do = (_this select 1) select 0; Make sense now! vbawol 1 Link to comment Share on other sites More sharing options...
0 TolH Posted June 19, 2017 Author Report Share Posted June 19, 2017 Just to add to this, after using: ["A new mission is now available.", 10] remoteExec ["Epoch_message",-2]; // -2 targets everyone but the server But in server rpt, this show up for each message send this way: (4:33:51 Wrong color format) . Edit: Also tried this: ["Mission starting in 5 seconds...", 5, [[0,0,0,0.2],[1,1,1,0.95]]] remoteExec ["Epoch_message",-2]; Still get Wrong color format in rpt Another script was doing it. Link to comment Share on other sites More sharing options...
Question
TolH
Hello,
Ive got a question about the epoch_message notification.
I really like the notification epoch uses and wanted to add it to my mission to notify player but i am having format problem.
this is what i did:
Client:
And server uses this to use it:
But as you can see on the picture below, the message copy the [ and the " "How can i get ride of it without breaking it. If i remove anything it doesn't work.
Thanks!
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now