Jump to content


Alpha Team Vanguard
  • Content Count

  • Joined

About hdparm

  • Rank
    Novark Citizen

Profile Information

  • Location:
  • backer_title
    Ruby Founder
  • Alpha

Recent Profile Visitors

6275 profile views
  1. This script stops your construct 80 km above a planet and holds it there with brakes. You lose less than 0.3 km of altitude per hour, so you can AFK for a day or two The script could be modified to use an AGG, but would it be useful?
  2. Do not modify existing files in Game/data/lua. If you do, EQU8 may kick you. Creating new files is allowed. EDIT: editing local .lua files is now allowed again.
  3. It's possible. What planet were you flying from? Could you record a video next time it happens? Also check the Lua chat tab for errors. EDIT: adding more vertical space engines apparently fixed this for Sunfyre.
  4. Many autopilot scripts exist, but most are not shared publicly. You may have to script it yourself
  5. About This is a basic autopilot script that can accelerate your construct towards a planet and later apply brakes to stop. Vertical space engines are used to control drift. Requirements Space brakes, 1.5+ g. Vertical space engines (pointing down), 0.3+ g. A remote controller or a separate hovercraft seat. Limitations No manual piloting. Use another script to get to space and to land. No collision avoidance. Make sure there are no planets, moons, asteroids, space stations or pirates between you and the destination. Planet positions are stored in the script. If NQ moves the planets, the script will have to be updated. Set-up With an auto-configuration schema (recommended) Download this file to Game\data\lua\autoconf\custom in your Dual Universe installation directory. By default it's C:\ProgramData\Dual Universe\Game\data\lua\autoconf\custom Right-click the control unit (a remote controller or a hovercraft seat) and select "Update custom autoconf list". This needs to be done only once. Right-click the control unit and select "Actions for this element", "Run custom autoconfigure", "Basic Space Autopilot". With a pasteable script configuration Open this link and copy everything to clipboard. Right-click the control unit (a remote control or a hover seat) and select "Actions for this element", "Paste Lua configuration from clipboard". The game should display a "Lua script loaded" message. If it did not, restart the game and copy the script configuration again. Link the core (required) and fuel tanks (optional) to the control unit. Credits Many planet positions were provided by @meigrafd from Hyperion. The script was bundled (amalgamated from multiple .lua files) using amalg. Change log 2020-09-23. Fixed heavy constructs not accelerating past 29997 km/h. A radar widget will be displayed if a PVP radar is linked (not available on remote controllers). Tested in r0.22.2. 2020-09-16. Posted the first version outside the NDA forums section. Tested in r0.21.6.
  6. About This is a short script that prints base max thrust of linked engines. It can serve as an example, and may also be used to detect which engines do not have a technician buff applied to them. Set-up Place a programming board. Link up to 10 engines to the programming board. In the Lua editor (right-click, "Advanced", "Edit Lua code") create a unit start() event handler with this code: -- detect linked engines local engines = {} for key, value in pairs(unit) do if type(value) == "table" and type(value.export) == "table" then -- `value` is an element and `key` is the slot name if value.getThrust and value.getMaxThrust then -- `value` is an engine engines[#engines + 1] = value end end end -- get engine names local engineNames = {} for _, engine in ipairs(engines) do -- engine name is available in its widget data -- for other elements `core.getElementNameById` would have to be used instead local dataJson = engine.getData() local data = json.decode(dataJson) engineNames[engine] = data.name or "???" end -- sort engines by name table.sort(engines, function (engine1, engine2) return engineNames[engine1] < engineNames[engine2] end) -- print engines and their base max thrust system.print("Linked engines: " .. #engines) for _, engine in ipairs(engines) do local name = engineNames[engine] local maxThrustBase = engine.getMaxThrustBase() system.print(string.format("%s: %.0f N", name, maxThrustBase)) end unit.exit() Click "Apply" in the Lua editor, exit build mode and activate the programming board. You should see base max thrust printed in the Lua chat tab. Change log 2020-09-13. Posted the first version (tested in r0.21.5).
  7. @FluxFaraday By default hover engines are "magicked" to produce thrust along gravity. This can be disabled by right-clicking the hover engine, selecting "Advanced" and "Disable Thrust Along Gravity". Vertical booster behavior can be changed too. You can right-click them and enable thrust along gravity.
  8. About This tool enables a somewhat different way of writing Dual Universe scripts. It takes a single Lua file that defines a global object with event handlers, and automatically generates a script configuration that can be pasted into a control unit. This allows writing the entire script outside the game, and automates away the need to manually set up each event handler. Prerequisites Some knowledge of Dual Universe Lua scripting (watch the official tutorial) Be able to run a Lua script from the command line. Download wrap.lua example-input.lua example-output.json Usage example Let's make a simple script that will react to key presses and display some text on a screen element. 1. Edit and save a Lua script in any plain text editor: -- Define a global script object with event handlers script = {} function script.onStart () -- Display some text screen.setCenteredText("script started") -- Create some timers to show that the script is working unit.setTimer("a", 2) -- timer id "a", ticks every 2 seconds unit.setTimer("b", 3) -- timer id "b", ticks every 3 seconds end function script.onStop () screen.setCenteredText("script stopped") end function script.onActionStart (actionName) screen.setCenteredText(actionName .. " key pressed") end function script.onActionStop (actionName) screen.setCenteredText(actionName .. " key released") end function script.onTick (timerId) screen.setCenteredText("timer " .. timerId .. " ticked") end -- Other events that are available by default: -- * onActionLoop(actionName): action key is held -- * onUpdate(): executed once per frame -- * onFlush(): executed 60 times per second, for physics calculations only; setEngineCommand must be called from here -- Slot events are available if slot type is set with the --slot command line option. function script.onMouseDown (x, y) screen.setCenteredText("mouse down: x=" .. x .. " , y=" .. y) end -- Call the start event handler -- Alternatively, initialization code can be placed anywhere in this file. -- The only requirement is that there is a global "script" object with event handlers script.onStart() Note: sometimes invalid characters are added when copying code from forums. If that happens, copy code from the provided link instead. 2. Run the packaging script: lua wrap.lua yourscript.lua yourscript.json --slots screen:type=screen --handle-errors --slots screen:type=screen sets first slot's name to screen and adds mouse down/up event support for that slot. --handle-errors adds error handling code, so that run-time Lua errors are displayed on the screen and in the Lua tab. 3. Open the resulting configuration file in a text editor, and copy everything to clipboard. 4. Inside Dual Universe, prepare a construct. There must be a programming board and a screen, and the screen must be linked into the programming board's slot 1. 5. Right-click on the programming board, select "Advanced", "Paste Lua configuration from clipboard". Done! The DU construct has been programmed without opening the in-game editor once. Activate the programming board and see if it works. Command line arguments Command line examples To produce a pasteable configuration for a custom piloting script: lua wrap.lua pilot.bundle.lua pilot.bundle.json --slots core gyro container_0 screen verticalEngine To produce a pasteable configuration for a radar script: lua wrap.lua radar.bundle.lua radar.bundle.json --handle-errors --default-slot type=pressable To produce an autoconf file for another custom piloting script: lua wrap.lua flight-enhancednav.bundle.lua flight-enhancednav.conf --output yaml --name "Airplane Cockpit (Enhanced)" --slots core:type=core gyro:type=gyro container:type=fuelContainer,select=all --handle-errors Known issues "Root node should be a map" This error is caused by wrong .conf file encoding. If you are using Powershell, the > operator saves the output with UCS-2 LE BOM encoding. Use cmd.exe instead, or replace > my.conf with | Out-File -Encoding UTF8 my.conf, or do not use output redirection, as the output file name can now be specified as an argument. Change log 2020-09-04. Posted the first version outside the NDA forums section. Output can now be written to a file without using output redirection. Credits This tool uses argparse and dkjson libraries, and was bundled using amalg.
  9. Unofficial Lua change log r0.22.4 Changes since r0.22.0: Core New functions: getElementPositionById(localId), getElementRotationById(localId), getElementTagsById(localId). Other global.lua is now inside game.ung and cannot be edited by players. Editing existing files in Game/data/lua should no longer trigger the EQU8 anti-cheat. r0.22.0 Changes since r0.21.3: PVP radar New functions: getConstructName(id), getConstructPos(id), getConstructSize(id), getConstructType(id), getEntries(), getRange(), hasMatchingTransponder(id). The getConstruct* functions return "unreachable" or { 0, 0, 0 }, even for construct information that's available in getData(). New events: enter(id), leave(id). r0.21.3 Changes since r0.21.2: Other package.loadlib has been disabled. r0.21.2 Changes since r0.20.0: Anti-Gravity Generator New function: getBaseAltitude(). PVP radar getData() no longer returns construct positions. Other pcall and xpcall can no longer be used to avoid the CPU instruction limit.
  10. This is the result of running the globals dumping script in-game on constructs that had various elements attached to them. Some exposed functions were called with pcall. The first value indicates whether the call was successful, the second is the actual function return value. All functions that return a vector return it as a table, not as a vec3 structure. Usually such functions will be called like this: local worldGravity = vec3(core.getWorldGravity()). Boolean values are returned as a number 0 or 1, and not as true or false. Element events are not listed here, as they cannot be detected by the dump.lua script. See the codex in-game (press F1) or outside the game (C:\ProgramData\Dual Universe\Game\documentation\web_codex.html) for event and function descriptions and other information. Anti-Gravity Generator r0.21.0 Control unit r0.21.2 Programming board exposes fewer functions compared to cockpit and seat. The control unit has references to linked elements, which are also available as local variables in each event handler. Event handlers defined in the script editor also get placed inside it. Here the control unit is a hovercraft seat that has 2 linked fuel tanks, a radar and a core. Core r0.22.4 Static cores have fewer functions compared to dynamic cores. Databank r0.21.2 Elements with a state r0.21.2 Detection areas, laser detectors and manual buttons expose the same functions. Their state is accessed using getState(). Elements with a toggle-able state r0.21.2 Force fields, ship doors, landing gears, manual switches and lights expose the same functions. The state is accessed using getState() and can be changed by activate(), deactivate() or toggle(). Emitter r0.21.2 Engine r0.21.0 Space engines, atmospheric engines, ailerons, air-brakes, retro-engines and adjustors expose the same functions. Usually engines are controlled through unit.setEngineCommand and do not require linking to the control unit. Fuel tank r0.21.2 Gyro r0.21.2 Industry Unit r0.21.2 Library r0.21.2 PVP radar (atmospheric and space) r0.22.0 Radar not available to craft or buy; for atmosphere and space radars see PVP radar instead Receiver r0.21.2 Screen r0.21.2 System r0.21.2 Telemeter r0.21.2 Warp Drive r0.21.0 Weapon r0.21.0
  11. Interesting. Someone should make a template for https://github.com/TypeScriptToLua/TypeScriptToLua too
  12. This is the output of a script that dumps all global variables. Lua coders may find this somewhat useful. The script was run in r0.21.2 on a hovercraft seat that has 2 fuel tanks and a radar linked. Some functions were called with pcall. The first value indicates whether the call was successful, the second is the actual return value or the error message. To see only elements' functions, visit this topic. Dumping script The script used for dumping is based on something I found on Stack Overflow, with some extensions. In unit start(): https://gist.github.com/d-lua-stuff/180707c172382d06d2c80213a1638f66 In system update(): coroutine.resume(dumping_coroutine) The script will run for a few seconds and then automatically turn off. Output is saved to Dual Universe 's log files in %LOCALAPPDATA%\NQ\DualUniverse\log Dump analyzer To avoid having to look through the logs manually, a Python script was written. It extracts the output of the globals dumping script from Dual Universe's log files, and creates separate files for dumped globals and for members of each linked element. Usage: pip install six python dump_analyzer.py C:\Path\To\Log\File.xml Change log 2020-09-01. Posted the first version outside the NDA forums section.
  13. See the test schedule: https://www.dualthegame.com/en/server-status/. The servers are currently offline (or closed to players).
  14. Yes, there is a chance of that happening if the developer uses his knowledge of upcoming changes. But as it is, developers won't directly see the problems with the game, and will have to make decisions based only on community manager feedback (with much of what's being said lost in translation), or what looks good on paper. IMHO this is worse than the risk of indirectly revealing some information. There likely are/were many [NDA] things that would be done differently if the developers played the game more with unprivileged accounts.
  • Create New...