Jump to content

mirq

Members
  • Posts

    29
  • Joined

  • Last visited

Recent Profile Visitors

561 profile views
  1. OMG, Cfrag The solution is fckin trivial. All this <profanity> for nothing It is the fourth way I discover to send commands from mission to hooks. It is stupid simple. You can restart anytime from mission. Wanna know ? Are you here ?
  2. Ok, All good, net.dostringin works in mission, but "GUI" is reported to be "invalid state name". We should find the correct state name to access GUI. Conclusion : there are only 3 state names that are allowed in dogsting_in: misison, export and config. But server works too. if we run with "mission" or "server" then net. is reported as nil value. The net. from inside the string . there is no net. in mission's net. space. Clear ? there is Group or Unit in mission but no net. Pretty strange. if we using "GUI" or anything else, the state is reported as "invalid state name" anyway, it is cool that dostring works in mission, you may run code from mission functions like get units, groups etc
  3. As it was not strange enough, i tried the following command: bullsmth.dostring_in("mission", "net.send_chat('asdad', true)") It reports that bullsmth is nil value So net. is not nil in mission. that's cool
  4. I am testing now. 1 minute So, it doesnt raise any erro, but does nothing. Absolutely nothing. Like it even does not exist in code. I checked this one: net.dostring_in("GUI", "net.send_chat('asdad', true)") Maybe "GUI" is not good there, let me check with "server" and others
  5. You are saying that net.dostring_in() is working from mission env ? Doesn't it raise an error ? like net. is nil ? I am curious, never tried. I am trying now
  6. I understand, so you need to restart the mission when a certain flag is triggered in mission. In my case i only start it periodically., dont care about flags. For that, you need that dostring return a value form mission . Theoretically it returns a string. You are trying to cast that string to a number. From my experiments I couldnt figure it out what dostring returns. Better log the return value and see what it is. Then decide if that's a number or a text. Your code should work if dostring behaves. Oh, by the way, shouldnt you write net.dostring_in('mission', ... instead of net.dostring_in('server', ... ? flags are defined in mission, maybe 'server' is ok, but lot of things are happening on clients part and reported back to server. Dunno, just asking. P.S. I checked docs, and there is no option for 'server', how did that land in your code ? Why did put all functions in smr table ? Get them out of there. They are not callbacks. Leave only on/simulationFrame(), and make all others local or global fucntions and variables The following I dont understand at all: net.doString_in("GUI", str) with str being "mn = DCS.getMissionFilename( ); success = net.load_mission(mn); return success" net.dostring_in is a function that runs only in GUI already. in net. space more precisely. This can be write only in a hook file, not miision file. If you write it in a hook file than it makes no sense. load_mission can be run directly without dostring. so there is no place for dostring_in in any mission file. you want to restart the mission from mission logic, not GUI. Ok, then you need to send info from misison to HOOKS. dostring can't do that, excepting the case it returns a value when run from HOOKS, but you need to write "mission" there not "server". Other than that, I know a method to make run code in HOOKS, directly from misiion. Any time, anything. You can check the flag in misison and send information to HOOKS to a function that will restart the mission.
  7. The code for restart: local Timer = 0 local PERIOD = 36000 -- seconds local PERIOD_MIN = PERIOD -120 function restart.onSimulationFrame() Timer = DCS.getModelTime() if (Timer < PERIOD_MIN ) then return else if (Timer < PERIOD ) then return else Timer=0 net.load_next_mission() -- you need to set your sever for "loop" -ing missions, and then you dont botter with lfs. If you have only one mission -- or --net.load_mission(lfs.writeDir() .. 'Scripts\\Hooks\\Missions\\' .. 'mission_name.miz') end end end As regards separation between hooks and msision, this is so well made that even if you block the GUI by a wrong function call in hooks, lets say this results in an infinite loop and framerate in GUI drops to 0, still in mision env those who are spawned and are playing already, they wont feel the drop of framerate in GUI at all, until they move to specs or another slot. They will freeze then. So the framerate drop that occurs in net.onSiulationFrame is absolutely negligible, it doesnt even exist. You can write all the logic for restarting in that callback
  8. Restart itself is much simpler. I can even do a restart with all players slot preserved. I will send the code for restart. As regards preserved slots it is complicated and it involves much logic. You can do it if study the order in which callbacks work in hooks. But why the hack would you invoke do_string for restarting mission? Hooks can officialy load a mission or load next mission by net.load_mission(). You dont need mission env for that. I will send the code.
  9. I will send you the exact code that does that
  10. Do_string works for anything. There is a missconception that this is for flags only. Dont believe everything they say
  11. But why do you need to run code from mission still ? What is exactly your aim ? I bet it can be solved in GUI only, and you will forget about mission. For example you can spawn AI from GUI hooks, you can destroy AI, everyhing you can do in mission youcan do from GUI hooks. You can send triiger text from GUI, and many more. So there are two kind of approacehs: 1. Run code from HOOKS to mission -> that's possible oficially via a_do_script 2. Run code from mission to HOOKS -> that's imposible oficially, but there are workarounds. Several Which one are you up to, and for what purpose ?
  12. That will never happen. I did it, as you already know, but in an un-orthodox way. For laymen , that's impossible. And here is why: iff you mean a lua file from hooks, than I suppose this contains code from net. and DCS. space. These spaces are not accessible in mission env, so if you import those hook ffiles in a mission file, a lot of errors will occur, as net. and DCS. are nil things there.
  13. But wait a minute. You are running a server or a client ? I you are making a server than there no risk for you. The risk is on the clients who de-sanitize access to folders and missions from servers run mallicious code on clients. On server you are supposed to be clean. Though I just discovered that clients can run code also, it cant reach the server. Yet
×
×
  • Create New...