KirkaFordis Rex Posted April 2, 2014 Posted April 2, 2014 Afternoon folks, I had a quick little question. I'm using a script (default lua script not MIST or slmod) in a mission that sends a message, that reads the value of a flag. trigger.action.outText( trigger.misc.getUserFlag ( '1' ), 5 ) This should display the numeric value of Flag 1 on the screen with a message box. It works beautifully, but only in single player. I hosted a multiplayer mission with some friends and the flag was still functioning (best i could tell) but no message to any player. Nor did I specify a player to send it to. I went back to single player and it works perfectly, just as before. What could be causing this? Is there a script that would work better? I've searched the forums and I can't seem to find anything pertaining to scripting messages and multiplayer. Likely due to either my incompetence with the search function, or I am just missing something that is just too obvious Suggestions? Questions? Links? Thanks i7-6700K, Gigabyte GTX1080 8GB , MSI Z170A, 32GB, 750W VFA-113
ENO Posted April 2, 2014 Posted April 2, 2014 (edited) In the script at the link below the guy does have an entry for which coalition the text box can be read. I think it might help. http://forums.eagle.ru/showthread.php?t=120325 Just go to the area where he has his env.variables written- that might get you pointed in the right direction. you can also download and look into the script further for pointers. Edited April 2, 2014 by ENO "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
ajax Posted April 2, 2014 Posted April 2, 2014 Is the outText statement within a scheduled function that repeats periodically? If not, that is if the statement is in a function that only executes once then I've found that in MP an outText statement can execute before you are in the cockpit and are able to see it. Also you shouldn't need to, but you might try converting the numeric value to a string before outputting it: trigger.action.outText( tostring(trigger.misc.getUserFlag ( '1' )), 5 ) 1
ENO Posted April 2, 2014 Posted April 2, 2014 Depending on how many values you have you might be able to just send message to all using the value as a condition. That's doing it the inefficient way, I know... but in the absence of alternatives I suppose the clone button can help reduce the workload. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
KirkaFordis Rex Posted April 2, 2014 Author Posted April 2, 2014 Just go to the area where he has his env.variables written- that might get you pointed in the right direction. you can also download and look into the script further for pointers. I don't quite understand what you mean. I understand that it might work to send the message to the coalition using the code below, but I'm unsure how to use it. I'm still looking for a good example. If I wanted to send this to Blue coalition, what would that look like? function trigger.action.outTextForCoalition(enum coalition.side coalition, string text, Time delay) Is the outText statement within a scheduled function that repeats periodically? If not, that is if the statement is in a function that only executes once then I've found that in MP an outText statement can execute before you are in the cockpit and are able to see it. ^^ This may be the issue. The trigger fires ONCE on MISSION START. Should I put a delay on it? And how much do you think? Also you shouldn't need to, but you might try converting the numeric value to a string before outputting it: trigger.action.outText( tostring(trigger.misc.getUserFlag ( '1' )), 5 ) Type( trigger.misc.getUserFlag ( '1' ) ) -> string it's already a string, do you think converting it would make a difference? I'm not sure how finicky DCS is. Depending on how many values you have you might be able to just send message to all using the value as a condition. I suppose that's possible. And a good work around for sure. I will do that if I can't figure this out. I'd prefer to know why it's behaving the way it is, to debug further scripting errors in the future. Thanks for your posts guys. i7-6700K, Gigabyte GTX1080 8GB , MSI Z170A, 32GB, 750W VFA-113
number3 Posted April 2, 2014 Posted April 2, 2014 "This may be the issue. The trigger fires ONCE on MISSION START. Should I put a delay on it? And how much do you think?" If you want it to print at the start of your mission add a condition to the trigger 'TIME MORE' (or something like that) so that it will execute X number of seconds from the start of the mission. You may also want to increase the length of time to have the message displayed on the screen. 314-я смешанная авиационная дивизия 314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119
ajax Posted April 2, 2014 Posted April 2, 2014 Type( trigger.misc.getUserFlag ( '1' ) ) -> string it's already a string, do you think converting it would make a difference? I'm not sure how finicky DCS is. If by chance the flag hasn't been defined yet, getUserFlag will return nil which will produce an error in your script. tostring will convert a nil value to the text 'nil' and no error results.
Yurgon Posted April 2, 2014 Posted April 2, 2014 I'm still looking for a good example. If I wanted to send this to Blue coalition, what would that look like? function trigger.action.outTextForCoalition(enum coalition.side coalition, string text, Time delay) It's a bit hidden in the Wiki, but there you'll find: coalition.side = { NEUTRAL, RED, BLUE } I haven't tested it, but the following should be a working example: trigger.action.outTextForCoalition(coalition.side.BLUE, "Alright guys, let's go get the Reds now!", 25) trigger.action.outTextForCoalition(coalition.side.RED, "Alright comrades, let's go get the Blues now!", 25) trigger.action.outTextForCoalition(coalition.side.NEUTRAL, "I'll go have a beer now and watch the others kill each other :)", 25) 1
KirkaFordis Rex Posted April 3, 2014 Author Posted April 3, 2014 I've found that in MP an outText statement can execute before you are in the cockpit and are able to see it. You may also want to increase the length of time to have the message displayed on the screen. This was indeed the issue. Anything 10 seconds or less would not stay on the screen long enough to see. Thank you gentlemen for your timely responses. -Kirk 1 i7-6700K, Gigabyte GTX1080 8GB , MSI Z170A, 32GB, 750W VFA-113
Recommended Posts