Jump to content

Lineaxe

Members
  • Posts

    235
  • Joined

  • Last visited

Everything posted by Lineaxe

  1. what the heck try out my random function as well . it gives you a few more options :)
  2. After many attempts at trying to use the DCS library and an example shown here in the forums , I had kept getting errors. Looking into lua documentation I found that #self was required when using the . syntax . Anyhow , playing around with the example and all the reading up I did I came up with a WORKING example of using get life with a static . No more nil methods , or can't find #self types of :noexpression:ERRORS .Whew ..... tempStaticObj = StaticObject.getByName("Ammo #004") tempSOhealth=tempStaticObj.getLife(tempStaticObj)
  3. also the pathway speech does not exist on the drive it must be a pathway being used by the module somehow else ...
  4. The dcs.log file can't find sounds and a search of my drives show they are not there Sooo, where are they ? Heheh, We bought the chopper now where is the sound ? sometimes a message comes up , but these messages are crucial to know and are flagging as errors in the dcs.log . Anyone know where I can get them from ? :helpsmilie: 2020-06-10 23:49:46.284 ERROR SOUND: can't load wave: "speech\eng\common\external cargo\messages\cargo_hooked" 2020-06-10 23:50:01.690 ERROR SOUND: can't load wave: "speech\eng\common\external cargo\messages\thirty_to_ground" 2020-06-10 23:50:04.801 ERROR SOUND: can't load wave: "speech\eng\common\external cargo\messages\sixty_to_ground" 2020-06-10 23:50:27.445 ERROR SOUND: can't load wave: "speech\eng\common\external cargo\messages\cargo_is_unhooked"
  5. ok , a reload of moose into the mission file fixed it.. it must have got messy in there somehow and corrupted. another bug that might want to be added into the pile :)
  6. Hi I have tried a couple of versions that I wrote and when I send them over all of a sudden they say they can't find global BASE: or any other one they used to find all the time. Is it inside lua developement tools or DCS mission editor ? dcs error log can't find BASE or SET_UNIT ... hmm .. ack
  7. I have been using glogg logger and it will give you instantaneous results at the bottom. Also it filters by such words as SCRIPTING and highlights them in colors that you choose. Makes going through logs much easier to read.
  8. Hi The coding can be done in lua . I setup a separate variable inside of lua just to keep score. Then you create event handlers to check to see if anything is the "DEAD" state. Well the rest you can dig up and keep reading as it's online somewhere.
  9. Hi , My new mission works great except I am getting these messages. Sometimes quite a few of them . I think they are coming from the RAT but I have also spawned some Tank units for both sides . Not many , 12 or 14 each side . created inside a while ... do ... end loop. Should be no problem with the code I would think. But if others are using moose's RAT can you tell me what I can do to stop the messages from popping up? 2020-06-03 17:02:04.923 INFO SCRIPTING: 41045( 62908)/E: AIRBASE00915.FindFreeParkingSpotForAircraft(Sir Abu Nuayr: Looking for 1 parking spot(s) for aircraft of size 19.5 m (x=19.5,y=4.7,z=5.2) at termial type 216.) 2020-06-03 17:02:04.923 INFO SCRIPTING: Error in timer function: [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:19722: Unit doesn't exist 2020-06-03 17:02:04.923 INFO SCRIPTING: stack traceback: [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:6076: in function <[string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:6073> [C]: in function 'getName' [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:19722: in function 'ScanObjects' [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:41080: in function 'FindFreeParkingSpotForAircraft' [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:62908: in function '_ModifySpawnTemplate' [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:59821: in function '_SpawnWithRoute' [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:60137: in function <[string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:60136> (tail call): ? [C]: in function 'xpcall' [string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:6129: in function <[string "C:\Users\jimru\AppData\Local\Temp\DCS.openbeta\/~mis0000613E.lua"]:6065>
  10. I like the ideas already :)
  11. well , that method is ONE of the ones that the random selector chooses from. just read the code and you can see that is so. This generator gives someone the OPTION of using a few throughout their code. not just one kind of generator.
  12. just learned something new after the upgrade . you have to comment out the line inside missionscripting.lua that sanitizes the 'os' module and thus wont let the code run ..I can see why they might want to do that. however I comment it out for the mission that I am writing up , anyhow. Much more power at your fingertips. It's like adding in the NA into XNA !!
  13. sample code please . I am working away on other little areas in my coding but my function calls with zone objects are failing at the moment. Must be in the syntax somewhere. Just tried putting the object in and it says it's nil . Not initialized I imagine. The global of course IS initialized and used in other parts of the code. including inside the function that I want to put it in as a argument. OK : Syntax that was missing is as follows: Place functions at bottom of code that initializes it . That way objects get recognized. Makes sense of course . I finally got a piece of code ,an event handler, which showed this clearly. Oh Well , so many computer languages to program in, just like human languages I guess. Next week I will forget this whole thing...
  14. oh, well the syntax I experimented with didnt work so I looked through all the lua info I could get and then tried looking for some sample code so I can use that syntax and it will work. the more I looked into functions online last night ,the more I ... ... ...
  15. while I was digging the the lua books online I found this in a discussion and changed it over a bit so it returns a random number in the range of 1 thru the number you input into it. Heh, I liked the code and the concept they were talking about and so , here it is , in a function :pilotfly: function randOSnumber(inpNumber) return ( tonumber(tostring(os.time()):reverse():sub(1,6)) )% inpNumber +1 end --ENDOF of course you can just take the code line out and use it by itself.. ok I played with it a bit and then came up with a larger function that let's you select which random generation style you want. There are 4 to choose from : os , math.random, a combo of both, and a 4th choice which is random selection of one of the first 3 choices ... that one potentially takes up the most cpu cycles of them all . so if you have a bit of time like at a start of mission , well , I pick 4 myself . that way I can debug the other 3 :) anyhow here is the code for it ... I am still testing , it might have a bug in it I can't see yet. Will test out a few other methods and add them in at some point. function randOSnumber(inpNumber,inpType) -- valid integers 1 thru 4 for now bflagit=false; inpType =math.abs(math.floor(inpType)) -- validation - absolute of integer portion only if (inpType>4 or inpType<1) then BASE:T({"inpType is not a 1,2,3 or 4: "..tostring(inpNumber)}) return end while (bflagit==false ) do if (inpType==1) then return ( tonumber(tostring(os.time()):reverse():sub(1,6)) )% inpNumber +1 elseif (inpType==2) then return math.random(inpNumber) elseif (inpType==3) then xx=( tonumber(tostring(os.time()):reverse():sub(1,6)) ) return math.random(xx)% inpNumber +1 elseif (inpType==4) then inpType=( tonumber(tostring(os.time()):reverse():sub(1,6)) )% 3 +1 end end bflagit=true -- never should get here , just returns in types 1,2 or 3 end --ENDOF randOSnumber
  16. lua syntax for using objects such as a zone ,or a SET_GROUP as arguments inside of functions. In c++ you set up pointers in general , so that you don't pass the whole object over.. you could do it that way as well of course , but mostly pointers are the better way to go. So if I want to access global variables (I created for using the moose clasees ) that are zone objects , Group objects , group sets and so on, what is the best syntax for doing this in lua ? heh so many computer languages and they all want to do it a different way!!! :megalol:
  17. I guess the real question here , after all that , is how do you know what zone is it using in the class method ForEachStaticInZone
  18. I am testing away using these 3 lines.:noexpression: zoneAirPort = ZONE:New("AirPortZone" )-- find a zone I created in mission editor -- this line works , still testing away.. objectinzoneSET:ForEachStaticNotInZone(zoneAirPort,function (StaticA) StaticA:MessageToAll("n.i.z.",5) BASE:T({"StaticA" .." N.I.Z."}) end ) -- this line works , -- set already created above this objectinzoneSET:ForEachStaticInZone(function (StaticA) StaticA:MessageToAll("*I.Z*",5) BASE:T({"StaticA" .."*I.Z*"}) end ) --- does not work also this class member function above does not accept a zone so it can decide if anything is in it or not ... so I thought it must be looking as the last ZONE object that was set somewhere?? ForEachStaticCompletelyInZone(zoneAirPort,function (StaticA) StaticA:MessageToAll("*I.Z*",5) BASE:T({"StaticA" .."*I.Z*"}) end ) -- this line works as well for alive objects I don't think for dead ones
  19. thanks for that. Now I won't be trying to muck about trying to find classes that would work with a coalition.static object . I had created a larger table that held each objects attributes such as name, position, etc. But I had heard about using sets and the advantage and so tried to set up coalition objects like those inside a set.
  20. I want to access features similar to what can be done with SET_Static: where the static elements are created inside of mission editor instead of on the fly in lua code . I can get access to these functions and run them with arguments the first way but not dynamically through code. functions such as the one that finds out if they are in our outside a certain zone and returns accordingly. This is not a problem from the staticobjects created inside of mission editor. oh.... i created these static objects earlier using coalition.addStaticObject(country.id.USA, mynewStaticObjArr) ..now I can't actually get any static object info such as health etc...or run any kind of tests using their subroutines (functions)
  21. I am looking hard for the syntax that will allow my to access my dynamically created static objects properties such as it's location and other functions in it's class .. I can't find any examples anywhere,, here is some of the code I found while looking online that has been modified a bit local statObjArr = coalition.getStaticObjects(2) --(1=Red 2=Blue) for i, staticObj in pairs(statObjArr) do local teststaticName = staticObj:getName() trigger.action.outText(teststaticName , 5) --this outputs each name -- I don'tknow at this point if staticObj as used here is a valid objectthat I can get properties from... so far I don't have the correct syntax. And can't find examples anywhere. currentStaticObj= StaticObject.getByName(teststaticName ) -- compiles .should now return a valid static object I can use? : failme = STATIC:FindByName( teststaticName ) STATIC not found for: teststaticName ---ERROR: actual name replaces the variable , and so on while i try to guess at the syntax needed to be able to use the properties of each coaltion.staticobject .
  22. really I just want the Lua debugger to send the CODE over. Not snoop at it and complain. Freezing up the whole operation in the process..Sheesh... can't find this, can't find that... eek ;. Maybe it runs better when mission is already running and it can find stuff then ... who knows I have had no luck and I noticed many others on eclipse forums as well as here have had much similar results. So short fix does work... Do notice the DOUBLE BACK SLASH (I kinda remember that from programming in windoz long ago. Lately I have been coding in Linux last 15 years or so . Much in c++, c, json, xml, javascript for clients and so on...)
  23. Ok , I post here my short fix for this . Since I really can't dig too deeply into Eclipse or JAVA runtime ... Another video demonstrated using a continuous dynamic load . It used _g.loadfile and recognized it as just loadfile . It is written inside of DCS mission editor . It uses the same trigger (999) set to true for the program to run dynamically. A new trigger running continuously that contains a DO SCRIPT with a line in it that says : SET FLAG (999,0) and a LINE such as: assert(loadfile"C:\\yourfolderlocation\\workspace\\yourmissionfolder\\yourmission/lua")() works for me . I only need it to run the script at mission start at the moment so I changed from continuous to run trigger at mission start. Later I will experiment with it loading while the mission is running.
  24. Hi All, Lua Development tools and DSC connect up but java engine does not recognize the following code: trigger.action.outText("sometext", 5) --debug line or any other code that is not basic lua code such as SET_GROUP and so on ... This is what I get when I run the debug. Happy I succeeded .but ... ---------------------------------------------------------------------------------------- Debugger v1.4.2 Debugger: Trying to connect to 127.0.0.1:10000 ... Debugger: Connection succeed. Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ...ents\LUA TOOLS\workspace\Icicles\src\main-backup.lua:4: attempt to index global 'trigger' (a nil value) at com.naef.jnlua.LuaState.lua_pcall(Native Method) at com.naef.jnlua.LuaState.call(LuaState.java:555) --------------------------------------------------------------------------- Any help ?? HELP ?? HEEEELLPP out there on how to fix this?
  25. decreased the wattage on beacon ... upped the AM Khz frequencies 470 and 490 ... perhaps too close together ? still testing away... Some interference ? Moved away from Airfield NDB and any other beacons already situated in the vicinity. The ADF display then started tracking the FM radio's Navigation all the way to the Target Still testin UHF AM AND USING THE VOR SYSTEM (working it seems for some signal Frequencies )
×
×
  • Create New...