Jump to content

Search the Community

Showing results for tags 'lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Forum Rules & Announcements
    • Forum Rules & Guidelines
    • Announcements
    • Patch Notes
  • New Player Landing Zone
    • New Player Help
    • FAQ & Information Desk
    • Gameplay Tutorials
    • Player Introductions
  • General (EN)
    • General Discussions
    • Lua Forum
    • Builder Forum
    • Industry Forum
    • PvP Forum
    • Public Test Server Feedback
    • The Gameplay Mechanics Assembly
    • Idea Box
    • Off Topic Discussions
  • General (DE)
    • Allgemeine Diskussionen
  • General (FR)
    • Discussions générales
  • Social Corner
    • Org Updates & Announcements
    • Roleplay & Lore
    • Fan Art

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location:


Interests


backer_title


Alpha

  1. Release BotMind -Static- All info on https://github.com/Star-Zet/bot-mind A little video about it's abilities: https://discord.com/channels/184691218184273920/748572194463940759/1084207649366749264
  2. I posted up a small example for my Modula scripting framework. It's still early days, but hopefully it will be of interest to someone, somewhere (possibly in a galaxy far, far away...).
  3. Hello, noveans! õ/ Today I bring you a project I've been working on for a while now, that intends on making Lua development quicker and more organized! About: This tool was initially built as a wrapper around hdparm's excellent wrap.lua script, which among many things allowed developing scripts outside DU, automating the creation of JSON config files, making events easier to work with, etc, and eventually evolved into a tool on its own. Basically, the CLI is a small command-line that allows you to create Lua projects from all sizes and shapes, be it a simple greeting script up or a multi-project system. Main Features: - Support for Lua scrpts with code distributed over multiple files, accessible via require statements, also supports multiple entry-points per project (multiple PBs or render scripts) - Support for importing of external packages via the CLI or from LUA_PATH - Support for render scripts - Support for minification and (experimental) compression - Support for code completion (intellisense) on Visual Studio Code and IntelliJ Idea, requires EmmyLua installed in both cases - Element link management built-in, allows you to indicate what each of the linked elements should be named as and its type - Autoconfig export in JSON, YAML and CONF formats - Syntax checks at compilation time - Optional helpers for linked element management, etc Website / Documentation / Source-code: https://github.com/wolfe-labs/du-luac Requisites and Installation: - You will need to have the Node.js runtime installed! Version 16 LTS is recommended. - For some functions to work, it's ideal to have Git installed too. Lua is optional. - Install via the command: npm i -g @wolfe-labs/du-luac - After installing, you should be able to run the CLI via the command: du-lua
  4. Dear @NQ-Ligo, I hope you will forgive me for the ping. During my twitch stream this morning @CodeInfused and I were trying to figure out what the currentProductAmount in industry getInfo() was supposed to be showing. It is bugged? My assumption was that maintainProductAmount was the number you wanted to have, and currentProductAmount was the number you currently had in the destination container. but it was always returning some number either way lower then it should be, like zero, or way larger then it should be, like 1.5trillion when i have 5010. None of us could figure out what else that number was supposed to represent. Perhaps you would be so good as to enlighten us. Is it just bugged? and not returning the correct number, or is it supposed to be returning something else? Thanks!
  5. Hi there, I know there is many way to make light blinks (using unit.tick, or analog elements) But in my opinion there should be functions in Lua like "toggleBlink": to toggle the blink state "setBlinkOffTime": to set blink off time "setBlinkOnTime": to set blink on time "getBlinkStatus": to know if blink is enable (1) or disable (0) (names are just here as exemple) and why not other function to enable/disable it directly ? This would allow us to easily switch a light from a blinking state to a static state
  6. We had it a while back in alpha, the getConstructWorldPos(id) for everything, without transponder, then players started to make construct following construct scripts and amazing AR scripts, which displeased JC who nerfed it hard. While players outsmart limitations and already found other ways, to get a coordinate, with triangulations, why keeping this function nerfed? At least allow us the use of getConstructWorldPos(id) for all statics and space cores and why not for stopped and unboarded dynamic cores . Numbers of abandoned constructs of all types and sizes, in atmo at any altitudes, and space, agg plateforms, elevators towers, floating bases etc... are increasing day by day The multiplications of sophisticated autopiloting scripts for example, where those coordinates information are crucial for good functioning and obstacles avoidance, this getConstructWorldPos(id) nerf just making piloting scripts uselessly heavier, therefore impacts on performances
  7. Intro With the recent dev-blogs, I feel like there's been a change in attitude with Lua. Before, we basically never got changes to it or the changes were very minimal/incomplete. (*cough* character orientation *cough*) But, now that we're adding a bunch of functions to Lua, so much so that it's starting to get cluttered with really long function names, I think a general structure change should occur. A perfect example is camera data. Structure Change The core unit, control unit and system basically are filled to the brim with functions that don't really related to them, especially system. So, here I go with what I believe should happen: The creation of a "Construct" default slot. (No links required) The creation of a "Player" default slot. (No links required) The creation of a "Database" default slot. (No links required) The creation of a "Elements" default slot. (No links required) Construct Slot (moved to) This slot will handle everything to do with the construct, and only the construct. As the first dev-blog has shown, a fair number of things are irrelevant of the core, thus it doesn't quite make sense that we should still access the core for them. For example, world orientation of the construct is irrelevant to the core, and even ordinary orientation is irrelevant to the core since it is based off the orientation unit, a gyro or core. However, data which is more core-related remains, like direct calculations/measurements that you would imagine the core making (velocity, acceleration etc.). Player Slot (moved to) This slot will handle everything to do with the master player, the player who has executed the control unit. As you can guess, a fair number of functions are placed on the unit because of this. But, it sort of makes little sense beyond the fact that the player activated, not to mention to access any player related info, they want to prefix every function with MasterPlayer, a perfect example of how absurdly long it is getting is unit.getMasterPlayerWorldForward(), now tack on camera to it... unit.getMasterPlayerCameraWorldForward(). You get the point. Database Slot (moved to) This will consolidate any thing that essentially accesses a database, static or otherwise, for instance getting the player name, position, etc. It will be similar to the Lua version in our files, but be entirely made of native code, instead of Lua. This should help with Database.lua's semi-redundancy and inefficiency, aside from code length contraction. Elements Slot (moved to) This will consolidate any general element function that is normally accessed by the core. This will remove the need to basically prefix stuff with getElementDATAById(uid) Instead, you will simple say getDATAById(uid) or getDATA(uid) Keys Bad Name* (Italics, suffixed by one or more light yellow asterisks, name requires a change for consistency reasons) ? Dev Blog Addition (Bold, prefixed by "New" emoji) moved to (Colour coded, moved to another slot) Suggested Addition (Bold, green) Core getData() getConstructMass() getConstructIMass() getConstructCrossSection() getMaxKinematicsParametersAlongAxis(taglist,crefaxis) getConstructWorldPos() getConstructId() ? getConstructName() ? getOrientationUnitId() getWorldAirFrictionAngularAcceleration() getWorldAirFrictionAcceleration() spawnNumberSticker(nb, x, y, z, orientation) spawnArrowSticker(x, y, z, orientation) deleteSticker(index) moveSticker(index, x, y, z) rotateSticker(index, angle_x, angle_y, angle_z) getElementIdList() getElementNameById(uid) getElementTypeById(uid) getElementHitPointsById(uid) getElementMaxHitPointsById(uid) getElementMassById(uid) getElementPositionById(uid) ? getElementForwardById(uid) ? getElementUpById(uid) ? getElementRightById(uid) getElementIndustryStatus(uid)* getElementTagsById(uid) getSchematicInfo(schematicId) getAltitude() ? getCurrentPlanetId() g()** getWorldGravity()*** getWorldVertical()**** getAngularVelocity() getWorldAngularVelocity() getAngularAcceleration() getWorldAngularAcceleraton() getVelocity() getWorldVelocity() ? getAbsoluteVelocity() ? getWorldAbsoluteVelocity()***** getWorldAcceleration() getConstructWorldOrientationForward() getConstructWorldOrientationRight() getConstructWorldOrientationUp() getConstructOrientationForward() getConstructOrientationRight() getConstructOrientationUp() getPvPTimer() getPlayersOnBoard()****** getDockedConstructs()******* isPlayerBoarded(pid) isConstructDocked(pid) forceDeboard(pid) forceUndock(cid) getBoardedPlayerMass(pid) getDockedConstructMass(cid) getParent() getCloseParents() getClosestParents() ? getParentPosition() ? getParentWorldPosition() ? getParentForward() ? getParentUp() ? getParentRight() ? getParentWorldForward() ? getParentWorldUp() ? getParentWorldRight() dock(pid) undock() setDockingMode(mode) getDockingMode() getCoreStress() getMaxCoreStress() getCoreStressRatio() All Events *getElementIndustryStatus() -> getElementIndustryStatusById() **g() -> getLocalConstructGravityIntensity() ***getWorldGravity() -> getConstructWorldGravity() ****getWorldVertical() -> getWorldGravity() *****getWorldAbsoluteVelocity() -> getAbsoluteWorldVelocity() (Swapping the Absolute Prefix with the World prefix sounds better and is probably more consistent) ******getBoardedPlayerIds() *******getDockedConstructIds() System getActionKeyName(actionName) showScreen(bool) setScreen(content) createWidgetPanel(label) destroyWidgetPanel(panelId) createWidget(panelId, type) destroyWidget(widgetId) createData(dataJson) destroyData(dataId) updateData(dataId, dataJson) addDataToWidget(dataId, widgetId) removeDataFromWidget(dataId, widgetId) getMouseWheel() getMouseDeltaX() getMouseDeltaY() getMousePosX() getMousePosY() getThrottleInputFromMouseWheel() getControlDeviceForwardInput()* getControlDeviceYawInput() getControlDeviceRightLeftInput()** lockView(state) isViewLocked() freeze(bool) isFrozen() getTime() getActionUpdateDeltaTime() getPlayerName(pid) getPlayerWorldPos(pid) ? getOrganizationName(oid) ? getOrganizationTag(oid) getWaypointFromPlayerPos() setWaypoint(waypointStr) getScreenHeight() getScreenWidth() getFov() print(msg) logInfo(msg) logWarning(msg) logError(msg) All Events *getControlDeviceForwardInput ->getControlDevicePitchInput **getControlDeviceRightLeftInput ->getControlDeviceRollInput ControlUnit exit() setTimer(timerTagId, period) stopTimer(timerTagId) getAtmosphereDensity() getClosestPlanetInfluence() ? getMasterPlayerPosition() ? getMasterPlayerWorldPosition() ? getMasterPlayerWorldForward() ? getMasterPlayerWorldUp() ? getMasterPlayerWorldRight() ? getMasterPlayerForward() ? getMasterPlayerUp() ? getMasterPlayerRight() getMasterPlayerId() getMasterPlayerMass() getMasterPlayerParent() ? getMasterPlayerOrgIds() setEngineCommand(...) setEngineThrust(taglist, thrust) setAxisCommandValue(axis, commandValue) getAxisCommandValue(axis) setupAxisCommandProperties(axis, commandType, targetSpeedRanges) setupControlMasterModeProperties(controlMasterModeId, displayName) getControlMasterModeId() cancelCurrentControlMasterMode() isAnyLandingGearExtended() extendLandingGears() retractLandingGears() isMouseControlActivated() isMouseDirectControlActivated() isMouseVirtualJoystickActivated() isAnyHeadlightSwitchedOn() switchOnHeadlights() switchOffHeadlights() isRemoteControlled() activateGroundEngineAltitudeStabilization(targetAltitude)* getSurfaceEngineAltitudeStabilization()* deactivateGroundEngineAltitudeStabilization()* computeGroundEngineAltitudeStabilizationCapabilities()* getThrottle() setSignalIn(plug, state) getSignalIn(plug) All Events *I got no idea what to replace those with, but the names are just weird, what's a surface engine, ground engine? Function name is super long. Construct getWorldOrientationForward() getWorldOrientationRight() getWorldOrientationUp() getOrientationForward() getOrientationRight() getOrientationUp() getWorldPos() getId() ? getName() ? getOrientationUnitId() getMass() getIMass() getCrossSection() getLocalGravityIntensity() Elements getIdList() getNameById(uid) getTypeById(uid) getHitPointsById(uid) getMaxHitPointsById(uid) getMassById(uid) getPositionById(uid) ? getForwardById(uid) ? getUpById(uid) ? getRightById(uid) getIndustryStatusById(uid) getTagsById(uid) getElementById(uid) Player getId() getMass() getParent() ? getOrgIds() lockView(state) isViewLocked() freeze(bool) isFrozen() getFov() getHorizontalFov(bool) getVerticalFov(bool) getHeadlampState() setHeadlampState(bool) isSeated() getSeatId() getCameraView() getCameraWorldForward() getCameraWorldUp() getCameraWorldRight() getCameraWorldPos() getCameraLocalForward() getCameraLocalUp() getCameraLocalRight() getCameraLocalPos() ? getBodyPosition() ? getBodyWorldPosition() ? getBodyWorldForward() ? getBodyWorldUp() ? getBodyWorldRight() ? getBodyForward() ? getBodyUp() ? getBodyRight() Database getPlayerName(pid) getPlayerWorldPos(pid) ? getOrganizationName(oid) ? getOrganizationTag(oid) getSchematicInfo(schematicId) getPlayerById(pid) getMasterPlayer() getOrganization(oid) getConstruct(cid) Camera Data Explanation The camera data is pretty straight forward. I made an code example and explanation before this mess, I'll just paste that here lol. local player = player --> A tab which virtually represents the "player", it holds player related events and functions. local isSeated = player.isSeated() --> Returns true or false if the player is seated or not. local seatId = player.getSeatId() --> Returns the player seat ID if seated, otherwise nil. local headlampState = player.getHeadlampState() --> Returns the boolean of the avatar headlamp, on or off. player.setHeadlampState(not headlampState) --> Inverts the headlamp state. local camView = player.getCameraView() --> Returns 0 for first-person, 1 for third-person and 2 for fixed third-person. -- Consideration to have is that you can get into third person while using the normal avatar using an emoji. -- Why it is useful is so you can change the HUD you intend on using depending on if you're in those seperate views and if you should listen to mouse input for UI, etc. local camWorldUp = player.getCameraWorldUp() --> Returns the camera up vector in world coodinates. local camWorldForward = player.getCameraWorldForward() --> Returns the camera forward vector in world coodinates. local camWorldRight = player.getCameraWorldRight() --> Returns the camera right vector in world coodinates. local camLocalUp = player.getCameraLocalUp() --> Returns the camera up vector in local coodinates, relative to the build grid. local camLocalForward = player.getCameraLocalForward() --> Returns the camera forward vector in local coodinates, relative to the build grid. local camLocalRight = player.getCameraLocalRight() --> Returns the camera right vector in local coodinates, relative to the build grid. local camLocalPos = player.getCameraLocalPos() --> Returns the camera position in local coordinates relative to the build-grid (construct) center. local camWorldPos = player.getCameraWorldPos() --> Returns the camera position in world coordiantes. --<! Optionally, you could add a relative world position function which is relative to the construct center, but in world coordinates. Though, I feel it would be very niche !>-- --- Lastly, local camHFov = player.getCameraHorizontalFov(true/false) --> Returns the horizontal fov with a boolean parameter to determine if it is returned as a radian or degree format. local camVFov = player.getCameraVerticalFov(true/false) --> Returns the vertical fov with a boolean parameter to determine if it is returned as a radian or degree format. Final Structure (No Formatting, mainly for glancing to see roughly the impact) Core getData() getMaxKinematicsParametersAlongAxis(taglist,crefaxis) getWorldAirFrictionAngularAcceleration() getWorldAirFrictionAcceleration() spawnNumberSticker(nb, x, y, z, orientation) spawnArrowSticker(x, y, z, orientation) deleteSticker(index) moveSticker(index, x, y, z) rotateSticker(index, angle_x, angle_y, angle_z) getAltitude() getCurrentPlanetId() getConstructWorldGravity() getWorldGravity() getAngularVelocity() getWorldAngularVelocity() getAngularAcceleration() getWorldAngularAcceleraton() getVelocity() getWorldVelocity() getAbsoluteVelocity() getAbsoluteWorldVelocity() getWorldAcceleration() getPvPTimer() getBoardedPlayerIds() getDockedConstructIds() isPlayerBoarded(pid) isConstructDocked(pid) forceDeboard(pid) forceUndock(cid) getBoardedPlayerMass(pid) getDockedConstructMass(cid) getParent() getCloseParents() getClosestParents() getParentPosition() getParentWorldPosition() getParentForward() getParentUp() getParentRight() getParentWorldForward() getParentWorldUp() getParentWorldRight() dock(pid) undock() setDockingMode(mode) getDockingMode() getCoreStress() getMaxCoreStress() getCoreStressRatio() All Events System getActionKeyName(actionName) showScreen(bool) setScreen(content) createWidgetPanel(label) destroyWidgetPanel(panelId) createWidget(panelId, type) destroyWidget(widgetId) createData(dataJson) destroyData(dataId) updateData(dataId, dataJson) addDataToWidget(dataId, widgetId) removeDataFromWidget(dataId, widgetId) getMouseWheel() getMouseDeltaX() getMouseDeltaY() getMousePosX() getMousePosY() getThrottleInputFromMouseWheel() getControlDevicePitchInput() getControlDeviceYawInput() getControlDeviceRollInput() getTime() getActionUpdateDeltaTime() getWaypointFromPlayerPos() setWaypoint(waypointStr) getScreenHeight() getScreenWidth() print(msg) logInfo(msg) logWarning(msg) logError(msg) All Events ControlUnit exit() setTimer(timerTagId, period) stopTimer(timerTagId) getAtmosphereDensity() getClosestPlanetInfluence() setEngineCommand(...) setEngineThrust(taglist, thrust) setAxisCommandValue(axis, commandValue) getAxisCommandValue(axis) setupAxisCommandProperties(axis, commandType, targetSpeedRanges) setupControlMasterModeProperties(controlMasterModeId, displayName) getControlMasterModeId() cancelCurrentControlMasterMode() isAnyLandingGearExtended() extendLandingGears() retractLandingGears() isMouseControlActivated() isMouseDirectControlActivated() isMouseVirtualJoystickActivated() isAnyHeadlightSwitchedOn() switchOnHeadlights() switchOffHeadlights() isRemoteControlled() activateGroundEngineAltitudeStabilization(targetAltitude) getSurfaceEngineAltitudeStabilization() deactivateGroundEngineAltitudeStabilization() computeGroundEngineAltitudeStabilizationCapabilities() getThrottle() setSignalIn(plug, state) getSignalIn(plug) All Events Construct getWorldOrientationForward() getWorldOrientationRight() getWorldOrientationUp() getOrientationForward() getOrientationRight() getOrientationUp() getWorldPos() getId() getName() getOrientationUnitId() getMass() getIMass() getCrossSection() getLocalGravityIntensity() Elements getIdList() getNameById(uid) getTypeById(uid) getHitPointsById(uid) getMaxHitPointsById(uid) getMassById(uid) getPositionById(uid) getForwardById(uid) getUpById(uid) getRightById(uid) getIndustryStatusById(uid) getTagsById(uid) getElementById(uid) Player getId() getMass() getParent() getOrgIds() lockView(state) isViewLocked() freeze(bool) isFrozen() getHorizontalFov(bool) getVerticalFov(bool) getHeadlampState() setHeadlampState(bool) isSeated() getSeatId() getCameraView() getCameraWorldForward() getCameraWorldUp() getCameraWorldRight() getCameraWorldPos() getCameraLocalForward() getCameraLocalUp() getCameraLocalRight() getCameraLocalPos() getBodyPosition() getBodyWorldPosition() getBodyWorldForward() getBodyWorldUp() getBodyWorldRight() getBodyForward() getBodyUp() getBodyRight() Database getPlayerName(pid) getPlayerWorldPos(pid) getOrganizationName(oid) getOrganizationTag(oid) getSchematicInfo(schematicId) getPlayerById(pid) getMasterPlayer() getOrganization(oid) getConstruct(cid) Ending Notes It has taken me literally the entire day doing this, and even then I feel like I've missed a lot because I was literally looking at the entirety of Lua. I was planning on explaining all the changes and stuff, but my head is about to explode from doing this the entire day so not gonna. Lol. Tbh, if they implemented even a single one of these slots, I would be happy. I don't expect most of it to change. I would also, personally, like if these changes came out gradually, if any. I think if camera angles are added though, we must at least get the player slot, or similar global variable because of how long the variable names will end up getting. Obligatory @NQ-Ligo and @NQ-Deckard, I wish you find this helpful, even if you don't add even 1% of it xD Oh, and oops. Kinda broke the "one idea" rule... it's kinda a super idea though. Hope whoever od
  8. Can we get a transparent periscope like it used to be? I have always used this code, but after the release of the Apollo update, the periscope is no longer transparent. local periscope = [[ <style> img { margin-top: 9vh; margin-left: -4vw; }</style> <img src="gunner_target.liveview" style="width: 40%; max-height: 100%; box-sizing: border-box">]] system.setScreen(periscope) system.showScreen(1)
  9. Three years and half after pre alpha launch, the best period ever for DU, everything got overcomplicated, heavy and excruciatingly laggy, especially at the introduction of industry 2.O which has changed till now fps, lag and loading times for everyone, but since the developers aren't testing nor playing their own game, very little have been done concerning the content and game mechanics. Since the beginning JC pretends that he wants to control the visual aspect of the game, but look at the thousands of player made atrocities and piles of elements scattered everywhere For those who never heard about, but there is a french simplistic and satiric cartoon called "Shadoks", where a group of engineers and workers, work hard together to make simple things more complicated, from where we are getting the expression: "why do simple when you can do complicated?" And this is exactly what is happening here But in real life, and i quote, professionals, engineers, designers, and architects will all agree: "Less is more" So here are my thoughts, after 3 years of hope and life time, on the bad and good decisions taken, and what could be improved at the moment: Building mechanics: Vertices editor should have been a priority long ago, long before that not so useful update on the line tool The actual given building tools are half of the reason why we see so much trash everywhere, and why most players are giving up, because voxelmancy is a considerable waste of time since ship selling will never be a major part of the market (everyone want to build his own), PVP will destroy it in a matter of seconds, and detailed or undetailed static or dynamic constructs' spaces are dead as hell. Vertices Editor: self explanatory Line tool: add triangular and circular shapes, and make one of the corners of the selection the center of rotation (not the center of selection, this doesn't make any sense) Paint tool: (omg seriously this one is the biggest joke and laziest decision taken) need to absolutely remove from the game this ridiculous number of different honeycombs, performance wise, and gameplay wise. Every material should have one and only one raw honeycomb, on which we could, using build mode, apply a color we want, a shininess type and or a pattern That would optimize the game code, our inventories/containers, and our factories (and will fix that uggly .24 update changes) Remove the deploy and selection sizes limitations Be more consistent in the deploy shapes size increment (1 by 1, not 1 2 3 4 5 6 8 12 16 24 32) * by the way change "galvanized" honeycomb name and check the definition of galvanized on wiki: which is a zinc coating process to protect different metals from rusting Elements: Here is the second half of the reason why we are surrounded by trashes First, element design is very badly fusing with the voxel building system, specially all the dynamic constructs elements, elements are detailed meshes that don't match with a voxel hull and the voxel default sizes Even after the best achievable voxelmancy, engines, brakes, hovers, wings, look like stains on our creations, element colors dont match available honeycomb colors, some elements are offsets, some are badly symmetrical I m not saying that its bad to have detailed mesh elements, but half of them, must be redesigned to be used and integrated "into" a basic voxel shapes, not to be put like a flower pot "on" the voxels, and this concerning all the elements used for designing ships Dynamic elements (engines, brakes, airfoils): those elements can be a single detailed face element, the face that will pop out from our voxels, and other faces must be designed with an easier global shape to work with the voxel grid (tubular, square, rectangle, just as Empyrion or Space engineers do...) Decorative elements: make sure they are scaled for the voxel grid and size (the reinforced sliding door is the perfect example of bad design and bad consideration) Ability to change elements main color Engines: no no no and no to all this different types of engines (safe/maneuver/military/etc...) with different recipes. again its a mess in inventories and markets, same problem as honeycombs, why doing simple when can do complicated?. while the quality (normal/advanced/rare etc...) should remain, all engines should be crafted as a standard factory type, and have an option by right clicking on them to change their mode type, and why not beeing able to change it using lua Flight mechanics: Overall the flight mechanics are very good, stable and well developed But, the main issue is bringing back to the dynamic elements issue and the overall aesthetic of the game and players creations Elements power/thrust should be multiplied by a minimum of 5!!!! this would greatly reduce the number of elements needed on each ship, reducing the lag and loading time, but most importantly we would not compromise anymore on the design in order to have "acceptable" flight performances (which will increase the visual quality of players creations) Vertical and horizontal cross sections must produce anti drift and high altitude lift, which will reduce the number of wings and stabilizers elements needed, and again will increase everyone performances due to less elements, and allow better ship design Fuel consumption to divide by 2 or more, we are tired to mine 2 hours, refine for an other hour, for 20min of flight (nowadays long distances planes can fly at cruise speed 900kmph for about 12 to 14 hours) LUA Lua is one of the greatest part of the game, allows the best customization possible, but is still way too limited, for no reasons Unlock to unlimited number of links/slots to a pb/remote/ECU/command chair etc... will reduce the number of scripts running at same time, so will increase performances (what is better? to have 10 scripts, on 10 PB, each one linked to 10 elements? or 1 script on 1 PB linked to 100 elements? do the math!) Increase again the recently nerfed CPU usage for custom scripts (they were not producing any client side performances issues, so why decreasing it again?) Increase the conf file allowed size, 150k isnt enough Make possible to install conf files on programming boards Increase Databank sizes Fix the rocket engine please for custom scripts, they are broken and deadly, they activate themselves when construct controls are taken Add function for camera relative rotation and position Ability to save scripts in our nanopack and exchange/sell scripts with DRM protection or not PVP I think pvp is a very delicate topic, but globally so few people have any interest in pvp at all due it its extrem unbalance In my opinion there is no goal and no reward in pvp, which makes it boring So much time and effort put in mining/producing/building a pvp-able ship that it pushes everyone away there should be no safe zone, nowhere! - heard and read too many stories of players ravaging orgs from the inside, secretly stealing work of dozens, and then venting themselves on streams. there should be no safe place in the universe for those people to hide their shameful loot - cargo ships should be accompanied and escorted by armed fleets, even while mining quantas could be physical/stockable/stealable claimed territories shouldnt be visible on the map, unless personally discovered surface ore stones, should be mine-able by anyone anytime anywhere (claimed or not. we should be able to get some fast scrap and fuel if we emergency land in middle of a huge claimed territory) static and dynamic construct need energy shields element containers content should not be destroyed unless the container lost all its lives (otherwise there will be no loot in pvp), they should just be inaccessible there should be a way to restore all lives on salvaged elements (repair unit maybe?) There is so much more to add, but please NQ consider and fix a big part of this first before adding new buggy "content" At some point there should be a planetary wipe, to leave space for the new planets design (allowing what ever is standing in space to be excluded from the wipe, for players beeing able to save enough to restart quickly)
  10. Purpose, Makes lights randomly change rgb colour and cycles them to give a breathing effect. Level: Lua beginner = cut and paste code, create filters unit start and system update in lua editor , DU = know how to link lights to a programming board Build You need 1 Programming Board(PB) and some lights. Connect the lights to the PB and name each slot in the lua editor (Ctrl L) you have connected l1 , l2 etc. If you don't want 8 then edit the source code and remove. code is below. Other stuff you can do : add a detector to autostart , change parameters in unit start to get the feel you like. -- copy and paste into unit start unit.hide() -- hides programming board -- remove these where you have not connected a light l1.activate() l2.activate() l3.activate() l4.activate() l5.activate() l6.activate() l7.activate() l8.activate() bClock = system.getTime() -- start clock origRgb = l1.getRGBColor() -- stores the colour of the original light if you want to reset lights on exit breathRate = 1 --export: rate of breathing Multiplier changeFrame = 1200 --export: frame colour and channel cycle rgbIndex = utils.round(math.random(3)) -- choose channel to breathe r = math.random(255) -- setup channels g = math.random(255) b = math.random(255) frameCount = 0 -- Copy and Paste into System update frameCount = frameCount + 1 if ( frameCount % changeFrame == 0 ) then --randomize rgb and channel r = math.random(255) g = math.random(255) b = math.random(255) rgbIndex = utils.round(math.random(3)) -- choose channel to breathe end nClock = system.getTime() local timeSeconds = ( nClock - bClock) local breath = utils.round(( math.exp( math.sin(timeSeconds * breathRate )) - 0.36787944 )* 108.0) if rgbIndex == 1 then r = breath elseif rgbIndex == 2 then g = breath else b = breath end -- set rgb colour of linked lights ,remove these where you have not connected a light l1.setRGBColor(r,g,b) l2.setRGBColor(r,g,b) l3.setRGBColor(r,g,b) l4.setRGBColor(r,g,b) l5.setRGBColor(r,g,b) l6.setRGBColor(r,g,b) l7.setRGBColor(r,g,b) l8.setRGBColor(r,g,b)
  11. i know i need to use a programming board but cant for the life of me find a tutorial on exactly how to accomplish this, id be super grateful if someone could point me in the right direction. Thanks for reading and good day Novians
  12. So You can no longer control warp drive with Lua Apparently it was because of emergency jump systems people made to avoid being pirated while hauling long distance and going afk and it was unfair for pirates. I believe the change is stupid because now it's unfair for everyone else but pirates, you have a warp drive and you can't even use it to run away? So here I'm suggesting my solution: Add jump calculation timer to warp drives. The timer should last like 1 minute or 90 sec, not sure how long, that time will have to be balanced. During jump calculation players cannot change their velocity (so cannot thrust or brake, however should be allowed to rotate), if they do the countdown will be canceled. Introducing that timer would make it most fair for both sides, it would give pirates a window to catch the hauler and fire on it (and that activates combat cooldown that is already in the game) and if the pirates are not able to catch the hauler in time it will jump away. And ofc make it possible to initiate that timer with Lua, you shouldn't except people to non stop sit in front of the PC during let's say 90 minute flight between planets.
  13. Die Mystic Dynasty hat sich folgende Bereiche zur Aufgabe gemacht: 1. Mining und Expansion 2. Schiffsbau und Design 3. Produktion und Forschung 4. Schiffshandel und Marketing Was wir dir bieten können: 1. Industrie auf Alioth 2. Discord für gemütliche Unterhaltungen. 3. Projekte innerhalb der einzelnen Bereiche sowie Corpweite Events. 4. Einführung in Dual Universe für Neulinge 5. Voxelmancy 6. LUA Programmierung 7. Du hast Familie kein Problem Das erwarten wir von dir: 1. Frustresistenz - "Es ist eine Beta, Bugs kommen und gehen... manche nennt man auch Features " 2. Lust am Miteinander in der Corp sowie Corp Beteiligung. 3. Mindestens 18+ 4. Discord beteiligung. Melde dich im Discord https://discord.gg/fqqRbHa bei derSchotte, KABOOM, ChipDE oder AepicA
  14. Main Page/Git Repo Features: All anti-gravity measurements and controls on one screen. Logarithmic altitude scale for more control at lower altitudes. Set target altitude with a slider or step at any power of 10 from 1 to 10,000 meters. Set target altitude to current altitude in one click. Lock controls to prevent accidental clicks. Power on and unlock protected by a drag-to-activate mechanism to prevent accidental disabling. Requirements: Anti-Gravity Generator (of appropriate size for ship core and with the appropriate number of pulsors linked to it) 1x Programming Board 1x Screen Databank (optional, for remembering controller state between sessions) Install/Use Instructions: Link to pre-built lua config for copy/pasting into a programming board Either build a json configuration (see Building from a Template below) or copy the one above and paste it as a Lua configuration into the programming board. Link the screen to the agScreen slot. Add links to the Anti-Gravity Generator, the Dynamic Core Unit, and the Databank if you have one. Order doesn't matter unless you edit the unit start handler to specify what slot is what instead of allowing it to autodetect them. Activate the programming board, either directly or with a signal. Get in the control seat of the ship so the ship is under control, then use the screen to adjust the antigravity.
  15. Hello all Noveans, So ive made a small program that i call Screen++ that enables you to add animations to your screens easily. You can use it to create geometrical shapes like ovals, circles or lines and animate them. You can make the geometrical shapes to move in x or y coordinate or change the colors of the border och background of the shapes in intervalls. You can add text and animate them the same way you can animate the geometrical shapes. Check out the newest version (below) to see what new features has been added. -------------------------------------------------------------------- NEW VERSION 3.0 -------------------------------------------------------------------- DATE: 2020 11TH OCTOBER --NEW in version 3.0: -- added ability to set background image, import any picture you like and display it on your screen, normal (use base64) -- +/- in displace elemets in all direction -- added rotation for all functions, clockwise or counter clockwise -- added triangle, normal and animated -- added rectangle, normal and animated (square, width=height) -- added ability to set backgroundcolor, normal and animated -- Z-index, whats elements that should be behind or infront of other elements -- added so all functions can have filled or transparent background (only border will show) -- possible to use Hexcolors -- use variables -- link code/animations to external elements (like a door for example) Tutorial on how to use Screen++ 3.0: I STRONGLY recommend that you watch the video on youtube and not here. Because ive putted timestamps so you easier can navigate through the video This is the link to the codes that you need to copy and past into your programming board (github): https://github.com/robarzangana/dualuniverseRepo/blob/main/screenplusplus_version_3.0 If you have any questions/requests be sure to tell me about them here or on youtube. I hope you'll enjoy it! -------------------------------------------------------------------- OLD VERSION 2.0 -------------------------------------------------------------------- Ive made a tutorial on youtube on how to use Screen++, and im sorry in advance, because i mess up few times in the video. (its my second video): This is the link to the codes that you need to copy and past into your programming board (github): https://github.com/robarzangana/dualuniverseRepo/blob/main/screenplusplus_version_2.0 If you have any questions/requests be sure to tell me about them here or on youtube. I hope you'll enjoy it!
  16. I run a L core factory and in a different location a S core store. If the store and factory were both in the same core I would be able to move stock from production side to sales side automatically. Since they are in different cores there is no way to move stock (that I am aware of) other than going to one location, sticking it in your cargo and going to the next location. 400 years in the future (not counting time in deep sleep) and you are telling me we can’t have a delivery drone ? Would it not not be possible to be able to link two cores together so they act as one larger virtual core as far as placement, linking and Lua are concerned?
  17. I dropped my old scripts from alpha into a repository: https://github.com/Helediron/dualuniverse No license nor usage restrictions.
  18. I just spent about 3days coding a preliminary ATC system for the org I'm in. It was working (for me) but realised the script in the tower shuts off if I wander >1km away or log off. This makes the ATC system worthless entirely. From what I can tell, LUA currently is mostly limited to things like cargo / inventory management (or making HTML games). Which is INCREDIBLY limiting. I think it would be cool to give players/orgs an 'allotment' to run / host scripts on a server. This would allow really cool systems such as ATC, Automated taxi lanes etc to work. For those super-serious about LUA and advanced systems like that, it could even be a 'premium' subscription option to get more allotment on the server. By allotment I mean an amount of CPU resources, and a script can be analysed to estimate how expensive the script will be on the server which takes up your allotment. If it goes over, you get a 5 minute or whatever warning to turn it (or another script) off to bring you under the limit or scripts will be shut off automatically.
  19. 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.
  20. Basic Ore Monitor. Requires 3 Programming Boards 2 Databanks --two is needed to prevent weird code crossing bugs. later this may be less when they fix bug. 20 Containers of same Size 1 screen 1 switch 1 relay PB1->switch-> relay-> PB2 PB3 Create Events in Lua Editor and Paste the Following as Instructed. 9/17 - Fixed parameter for single boards.Changed some names and Added more exports Programming Board 1 -- Can do 9 Containers OR Read from Databanks ---screen ---databank-----only if your doing more than 9 items added last ---databank2-----only if your doing more than 9 items(using 2 helps code from being crossed from bugs)added last ---switch-----only if your doing more than 9 items ----Unit Start if Morethan9slots == "On" then switch.activate() end unit.setTimer("Live",1) unit.hide() ----Unit Tick ---Name the Tick Live Morethan9slots = "Off" --export:Off for 9 slots and On for more than 9 and requires databanks. local containermax = 9600 --export:;Your max container holding. local slot1item = "Bauxite" --export:;Slot1 Iten. local slot1weight = 1.28 --export:;Slot1 weight. local slot2item = "Coal" --export:;Slot2 Iten. local slot2weight = 1.35 --export:;Slot2 weight. local slot3item = "Hematite" --export:;Slot3 Iten. local slot3weight = 5.04 --export:;Slot3 weight. local slot4item = "Quartz" --export:;Slot4 Iten. local slot4weight = 2.65 --export:;Slot4 weight. local slot5item = "Chromite" --export:;Slot5 Iten. local slot5weight = 4.54 --export:;Slot5 weight. local slot6item = "Limestone" --export:;Slot6 Iten. local slot6weight = 2.71 --export:;Slot6 weight. local slot7item = "Malachite" --export:;Slot7 Iten. local slot7weight = 4.0 --export:;Slot7 weight. local slot8item = "Natron" --export:;Slot8 Iten. local slot8weight = 1.55 --export:;Slot8 weight. local slot9item = "Acanthite" --export:;Slot9 Iten. local slot9weight = 7.2 --export:;Slot9 weight. if Morethan9slots == "Off" then local dbhtml = "" local dhtml = "" local index = {1, 2, 3, 4, 5, 6, 7, 8, 9} -- Row of Container? local containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display local htmlContent = "" for i=1, #containers do htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>" end local html = [[ <table style=" margin-left: auto; margin-right: auto; width:30%; font-size:1.25em; text-align:left;"> <tr style = " background-color:Purple; color:black !important;"> <svg> <g> <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB1</text> </g></svg> <th>Row</th> <th>Product</th> <th>Container%</th> <th>Total Ore</th> </tr> ]]..htmlContent..[[ </table>]] screen.setHTML(html) elseif Morethan9slots == "On" then switch.activate() dbhtml = databank.getStringValue(OreMonitorTwo) dhtml = databank2.getStringValue(OreMonitorThree) local index = {1, 2, 3, 4, 5, 6} -- Row of Container? local containers = {slot1, slot2, slot3, slot4, slot5, slot6} -- slot names local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight} -- inspected kg of item local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item} -- names to display local htmlContent = "" for i=1, #containers do htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>" end local html = [[ <table style=" margin-left: auto; margin-right: auto; width:30%; font-size:1.25em; text-align:left;"> <tr style = " background-color:Purple; color:black !important;"> <svg> <g> <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB1</text> </g></svg> <th>Row</th> <th>Product</th> <th>Container%</th> <th>Total Ore</th> </tr> ]]..htmlContent..[[]]..dbhtml..[[]]..dhtml..[[ </table>]] screen.setHTML(html) end ---Unit Stop if Morethan9slots == "On" then switch.deactivate() end screen.clear() Programming Board 2 --databank is last slot to add and named databank ---Unit Start unit.setTimer("Live",1) unit.hide() ----Unit Tick ---Name the Tick Live --databank is last slot to add and named databank local slot1item = "Malachite" --export:;Slot1 Iten. local slot1weight = 4.0 --export:;Slot1 weight. local slot2item = "Natron" --export:;Slot2 Iten. local slot2weight = 1.55 --export:;Slot2 weight. local slot3item = "Acanthite" --export:;Slot3 Iten. local slot3weight = 7.2 --export:;Slot3 weight. local slot4item = "Garnierite" --export:;Slot4 Iten. local slot4weight = 2.60 --export:;Slot4 weight. local slot5item = "Petalite" --export:;Slot5 Iten. local slot5weight = 2.41 --export:;Slot5 weight. local slot6item = "Pyrite" --export:;Slot6 Iten. local slot6weight = 5.01 --export:;Slot6 weight. local slot7item = "Colbaltite" --export:;Slot7 Iten. local slot7weight = 6.33 --export:;Slot7 weight. local slot8item = "Cryolite" --export:;Slot8 Iten. local slot8weight = 2.95 --export:;Slot8 weight. local slot9item = "Gold Nuggets" --export:;Slot9 Iten. local slot9weight = 19.30 --export:;Slot9 weight. local dbhtml = "" local dhtml = "" local index = {7, 8, 9, 10, 11, 12, 13, 14, 15} -- Row of Container? local containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display local htmlContent = "" local containermax = 9600 --export:;Your max container holding. for i=1, #containers do htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>" end local html = [[ <table style=" margin-left: auto; margin-right: auto; width:30%; font-size:1.25em; text-align:left;"> <tr style = " background-color:Purple; color:black !important;"> <svg> <g> <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB2</text> </g></svg> <th>Row</th> <th>Product</th> <th>Container%</th> <th>Total Ore</th> </tr> ]]..htmlContent..[[ </table>]] databank.setStringValue(OreMonitorTwo,html) Programming Board 3 --databank is last slot to add and named databank ---Unit Start unit.setTimer("Live",1) unit.hide() ----Unit Tick ---Name the Tick Live --databank is last slot to add and named databank local slot1item = "Kobelckite" --export:;Slot1 Iten. local slot1weight = 2.37 --export:;Slot1 weight. local slot2item = "Columbite" --export:;Slot2 Iten. local slot2weight = 5.38 --export:;Slot2 weight. local slot3item = "Illmenite" --export:;Slot3 Iten. local slot3weight = 4.55 --export:;Slot3 weight. local slot4item = "Rhodonite" --export:;Slot4 Iten. local slot4weight = 3.76 --export:;Slot4 weight. local slot5item = "Vanadinite" --export:;Slot5 Iten. local slot5weight = 6.95 --export:;Slot5 weight. local slot6item = "Not set" --export:;Slot6 Iten. local slot6weight = 0 --export:;Slot6 weight. local slot7item = "Not set" --export:;Slot7 Iten. local slot7weight = 0 --export:;Slot7 weight. local slot8item = "Not set" --export:;Slot8 Iten. local slot8weight = 0 --export:;Slot8 weight. local slot9item = "Not set" --export:;Slot9 Iten. local slot9weight = 0 --export:;Slot9 weight. local index = {16, 17, 18, 19, 20} -- Row of Container? local containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names local weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item local items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display local htmlContent = "" local containermax = 1200 --export:;Your max container holding. for i=1, #containers do htmlContent = htmlContent .. "<tr>".."<th>"..index[i].."</th><th>"..items[i].."</th><th>"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100)).."%</th><th>"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5).."</th><tr>" end local html = [[ <table style=" margin-left: auto; margin-right: auto; width:30%; font-size:1.25em; text-align:left;"> <tr style = " background-color:Purple; color:black !important;"> <svg> <g> <text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="30" id="svg_8" y="50" x="10" stroke="#ff0000" fill="#ff7f00">PB3</text> </g></svg> <th>Row</th> <th>Product</th> <th>Container%</th> <th>Total Ore</th> </tr> ]]..htmlContent..[[ </table>]] databank.setStringValue(OreMonitorThree,html) Pasteable Config for Programming Board 1. Hook up all containers (Bauxite, Coal, Hematite, Quartz, Chromite, Limestone)first and then link switch, screen, databank, databank2 and named them accordingly in the Lua editor slot area. Leave containers slots alone. {"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"switch","type":{"events":[],"methods":[]}},"7":{"name":"screen","type":{"events":[],"methods":[]}},"8":{"name":"databank","type":{"events":[],"methods":[]}},"9":{"name":"databank2","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"if Morethan9slots == \"On\" then\nswitch.activate()\nend\n\n\nunit.setTimer(\"Live\",1)\nunit.hide()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"0"},{"code":"if Morethan9slots == \"On\" then\nswitch.deactivate()\nend\n\nscreen.clear()\n","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"1"},{"code":"Morethan9slots = \"Off\" --export:Off for 9 slots and On for more than 9 and requires databanks.\nlocal containermax = 9600 --export:;Your max container holding.\nlocal slot1item = \"Bauxite\" --export:;Slot1 Iten.\nlocal slot1weight = 1.28 --export:;Slot1 weight.\nlocal slot2item = \"Coal\" --export:;Slot2 Iten.\nlocal slot2weight = 1.35 --export:;Slot2 weight.\nlocal slot3item = \"Hematite\" --export:;Slot3 Iten.\nlocal slot3weight = 5.04 --export:;Slot3 weight.\nlocal slot4item = \"Quartz\" --export:;Slot4 Iten.\nlocal slot4weight = 2.65 --export:;Slot4 weight.\nlocal slot5item = \"Chromite\" --export:;Slot5 Iten.\nlocal slot5weight = 4.54 --export:;Slot5 weight.\nlocal slot6item = \"Limestone\" --export:;Slot6 Iten.\nlocal slot6weight = 2.71 --export:;Slot6 weight.\nlocal slot7item = \"Malachite\" --export:;Slot7 Iten.\nlocal slot7weight = 4.0 --export:;Slot7 weight.\nlocal slot8item = \"Natron\" --export:;Slot8 Iten.\nlocal slot8weight = 1.55 --export:;Slot8 weight.\nlocal slot9item = \"Acanthite\" --export:;Slot9 Iten.\nlocal slot9weight = 7.2 --export:;Slot9 weight.\n\nif Morethan9slots == \"Off\" then\nlocal dbhtml = \"\"\nlocal dhtml = \"\"\nlocal index = {1, 2, 3, 4, 5, 6, 7, 8, 9} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display\nlocal htmlContent = \"\"\nfor i=1, #containers do\n htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n <svg>\n <g>\n <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB1</text> \n </g></svg>\n <th>Row</th>\n <th>Product</th>\n <th>Container%</th>\n <th>Total Ore</th>\n </tr>\n ]]..htmlContent..[[\n</table>]]\n\nscreen.setHTML(html)\nelseif Morethan9slots == \"On\" then\nswitch.activate()\ndbhtml = databank.getStringValue(OreMonitorTwo)\ndhtml = databank2.getStringValue(OreMonitorThree)\nlocal index = {1, 2, 3, 4, 5, 6} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item} -- names to display\nlocal htmlContent = \"\"\nfor i=1, #containers do\n htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n <svg>\n <g>\n <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB1</text> \n </g></svg>\n <th>Row</th>\n <th>Product</th>\n <th>Container%</th>\n <th>Total Ore</th>\n </tr>\n ]]..htmlContent..[[]]..dbhtml..[[]]..dhtml..[[\n</table>]]\n\nscreen.setHTML(html)\n\nend\n\n\n","filter":{"args":[{"value":"Live"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"2"},{"code":"dbhtmltwo = databank.getStringValue(OreMonitorTwo)\nscreen.setHTML(dbhtmltwo)","filter":{"args":[{"value":"option2"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"3"},{"code":"local index = {1, 2, 3, 4, 5, 6, 7} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7} -- slot names\nlocal weights = {1.28, 1.35, 5.04, 2.65, 4.54, 2.71, 4.0} -- inspected kg of item\nlocal items = {\"Bauxite\", \"Coal\", \"Hematite\", \"Quartz\", \"Chromite\", \"Limestone\", \"Malachite\"} -- names to display\nlocal htmlContent = \"\"\n\nfor i=1, #containers do\n htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><th>\"..items[i]..\"</th><th>\"..index[i]..\"</th></tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:25%;\nfont-size:1.25em;\ntext-align:left;\">\n <tr style = \"\nbackground-color:Blue;\ncolor:black !important;\">\n <th>Amount</th>\n <th>Row</th>\n <th>#</th>\n </tr>\n ]]..htmlContent..[[]]..dbhtmltwo..[[]]..dbhtml..[[\n</table>]]\n\nscreen.setHTML(html)\n","filter":{"args":[{"value":"option1"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"4"},{"code":"dbhtmlthree = databank.getStringValue(fuck)\nscreen.setHTML(dbhtmlthree)","filter":{"args":[{"value":"option3"}],"signature":"actionStart(action)","slotKey":"-2"},"key":"5"}],"methods":[],"events":[]} Programming Board 2 Link containers(Malachite, Natron, Acanthite, Garnieririte, Petalite, Pyrite, Cobaltite, Cryolite, Gold Nuggets First and then Last slot is databank and named like so. {"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"databank","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"--databank is last slot to add and named databank\n\n\nlocal slot1item = \"Malachite\" --export:;Slot1 Iten.\nlocal slot1weight = 4.0 --export:;Slot1 weight.\nlocal slot2item = \"Natron\" --export:;Slot2 Iten.\nlocal slot2weight = 1.55 --export:;Slot2 weight.\nlocal slot3item = \"Acanthite\" --export:;Slot3 Iten.\nlocal slot3weight = 7.2 --export:;Slot3 weight.\nlocal slot4item = \"Garnierite\" --export:;Slot4 Iten.\nlocal slot4weight = 2.60 --export:;Slot4 weight.\nlocal slot5item = \"Petalite\" --export:;Slot5 Iten.\nlocal slot5weight = 2.41 --export:;Slot5 weight.\nlocal slot6item = \"Pyrite\" --export:;Slot6 Iten.\nlocal slot6weight = 5.01 --export:;Slot6 weight.\nlocal slot7item = \"Colbaltite\" --export:;Slot7 Iten.\nlocal slot7weight = 6.33 --export:;Slot7 weight.\nlocal slot8item = \"Cryolite\" --export:;Slot8 Iten.\nlocal slot8weight = 2.95 --export:;Slot8 weight.\nlocal slot9item = \"Gold Nuggets\" --export:;Slot9 Iten.\nlocal slot9weight = 19.30 --export:;Slot9 weight.\nlocal dbhtml = \"\"\nlocal dhtml = \"\"\nlocal index = {1, 2, 3, 4, 5, 6, 7, 8, 9} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display\nlocal htmlContent = \"\"\nlocal containermax = 9600 --export:;Your max container holding.\nfor i=1, #containers do\n htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n <svg>\n <g>\n <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB2</text> \n </g></svg>\n <th>Row</th>\n <th>Product</th>\n <th>Container%</th>\n <th>Total Ore</th>\n </tr>\n ]]..htmlContent..[[\n</table>]]\n\n\ndatabank.setStringValue(OreMonitorTwo,html)\n","filter":{"args":[{"value":"Live"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"0"},{"code":"unit.setTimer(\"Live\",1)\nunit.hide()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"}],"methods":[],"events":[]} Programming Board 3 Link containers(Kobelckite, Columbite, Illemnite, Rhodonite, Vanadinite) First and then Last slot is databank and named like so. {"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"databank","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"--databank is last slot to add and named databank\n\nlocal slot1item = \"Kobelckite\" --export:;Slot1 Iten.\nlocal slot1weight = 2.37 --export:;Slot1 weight.\nlocal slot2item = \"Columbite\" --export:;Slot2 Iten.\nlocal slot2weight = 5.38 --export:;Slot2 weight.\nlocal slot3item = \"Illmenite\" --export:;Slot3 Iten.\nlocal slot3weight = 4.55 --export:;Slot3 weight.\nlocal slot4item = \"Rhodonite\" --export:;Slot4 Iten.\nlocal slot4weight = 3.76 --export:;Slot4 weight.\nlocal slot5item = \"Vanadinite\" --export:;Slot5 Iten.\nlocal slot5weight = 6.95 --export:;Slot5 weight.\nlocal slot6item = \"Not set\" --export:;Slot6 Iten.\nlocal slot6weight = 0 --export:;Slot6 weight.\nlocal slot7item = \"Not set\" --export:;Slot7 Iten.\nlocal slot7weight = 0 --export:;Slot7 weight.\nlocal slot8item = \"Not set\" --export:;Slot8 Iten.\nlocal slot8weight = 0 --export:;Slot8 weight.\nlocal slot9item = \"Not set\" --export:;Slot9 Iten.\nlocal slot9weight = 0 --export:;Slot9 weight.\nlocal index = {16, 17, 18, 19, 20} -- Row of Container?\nlocal containers = {slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9} -- slot names\nlocal weights = {slot1weight, slot2weight, slot3weight, slot4weight, slot5weight, slot6weight, slot7weight, slot8weight, slot9weight} -- inspected kg of item\nlocal items = {slot1item, slot2item, slot3item, slot4item, slot5item, slot6item, slot7item, slot8item, slot9item} -- names to display\nlocal htmlContent = \"\"\nlocal containermax = 1200 --export:;Your max container holding.\nfor i=1, #containers do\n htmlContent = htmlContent .. \"<tr>\"..\"<th>\"..index[i]..\"</th><th>\"..items[i]..\"</th><th>\"..math.ceil(((math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)/containermax)*100))..\"%</th><th>\"..math.ceil((containers[i].getItemsMass()/weights[i]) - 0.5)..\"</th><tr>\"\nend\nlocal html = [[\n<table style=\"\nmargin-left: auto;\nmargin-right: auto;\nwidth:30%;\nfont-size:1.25em;\ntext-align:left;\">\n <tr style = \"\nbackground-color:Purple;\ncolor:black !important;\">\n <svg>\n <g>\n <text xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"30\" id=\"svg_8\" y=\"50\" x=\"10\" stroke=\"#ff0000\" fill=\"#ff7f00\">PB3</text> \n </g></svg>\n <th>Row</th>\n <th>Product</th>\n <th>Container%</th>\n <th>Total Ore</th>\n </tr>\n ]]..htmlContent..[[\n</table>]]\ndatabank.setStringValue(OreMonitorThree,html)\n\n","filter":{"args":[{"value":"Live"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"0"},{"code":"unit.setTimer(\"Live\",1)\nunit.hide()","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"1"}],"methods":[],"events":[]}
  21. Here is a quick video tutorial on how to install and some basic usage for this version. ➡️Video Tutorial⬅️ It was brought to my attention that the spoilers were giving errors when pasted to the programming boards. The spoilers were removing bits of the JSON for some reason. So instead, I have added links to the code located between these ➡️⬅️. You can either right click the link and Save As. Or you can click on the link which will open a new page. You copy and paste the entire page into your programming board. This is a work in progress. The development is completed, but it is constantly being refined and upgraded. I encourage and welcome feedback and you are more than welcome to submit your own code, in the comments, for consideration. You can also email me using the link in the first comment. See 1st comment for more info. Here is the JSON code. Just copy/paste it to the programming board. There was a problem pasting the JSON into a spoiler, so I am making it available for download. Right click and Save as, or just click the link and copy the entire page and paste to PB. See video link at top of this post for a tutorial. ***I wasn't able to get rid of the graphics glitch entirely, but I significantly reduced the shift. Now, it's a minor annoyance instead of a massive pain. ➡️ New Industry HUD.⬅️
  22. 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).
  23. I have been working on a script to construct HTML for those who want a simple tool yet quite powerfull I hope. The Idea is to have the script as a file in your Lua environement and just use the require() function, then start building your HTML. There is a demo at the end of the script (put the commented lines in your unit.start then uncomment them) HTMLhandler = require(HTMLhandler) HUD = HTMLhandler:Create(system) Features: The tool accept multiple monitors at once, like several screens or HUD (system). myHTMLhandler:Create(system,screen1) Simple usage: To get a simple window inside a left grid in your cockpit you can do: local myHTMLhandler = require("HTMLhandler") normalScreen = myHTMLhandler:Create(system) local baseGrid = myHTMLhandler:addDiv("", "left grid") local myWindow, myWindowContent = myHTMLhandler:addWindow(baseGrid, "MyWindow", "Inside the window") ---- change the content inside the window ---- local changeInside = "change the inside of the window" myHTMLhandler:updateContent(myWindowContent, changeInside) You can create a div with a string or a variable like that myHTMLhandler:createDiv(myVar) and it will display on the selected screen as long as the variable accept the tostring() conversion. You can pass in parameter custom style or/and class. There is also function to create a window and a table. At any time you can change the content as the "addx" functions returns a contentId. For the table, when created you get a table of contentId to modify the column's header and when adding a line you get a table of contentId to modify what's in the line. You can also delete a line or push a new line at the top of the table. indexSimpleDiv = myHTMLhandler:addDiv("simpleDiv") myHTMLhandler:addDiv(indexSimpleDiv, "anotherDiv in SimpleDiv") myHTMLhandler:deleteElement(indexSimpleDiv) -- the anotherDiv will be anchor into the simple Div, but once you delete the simpleDiv it will also delete its child, being "anotherDiv" mainDiv, contentIdMainDiv = myHTMLhandler:addDiv("MainDiv", "left grid") -- this will create a div with the content "MainDiv" and class "left" and "grid" local tableDiv = myHTMLhandler:addDiv(mainDiv, "", "window") -- create a div with the class window as NQ style (works only with HUD) local columnHeaders = {"Name", "Quantity", "Container", "Container size"} --define the title of the column's header for the table local simpleTable = myHTMLhandler:addSimpleTable(tableDiv, columnHeaders) -- create a table with headers local firstLine = {"Gold", "153kL", "Treasure", "L"} local firstLineId, firstLineContentId = myHTMLhandler:addSimpleLine(simpleTable, firstLine) -- add a first line local secondLine = {"Silver", "20kL", "Chest"} local secondLineId = myHTMLhandler:addSimpleLine(simpleTable, secondLine) --add a second line but without data in the last column local pushToFirstLine = {"Plastic", "FULL", "line pushed #1", "M"} myHTMLhandler:addSimpleLine(simpleTable, pushToFirstLine, 2) -- add a third line but at the top position in the table (1 being the headers) myHTMLhandler:updateContent(firstLineContentId[2], "20kL") -- change the amount of gold of "firstLine" Advanced usage: You can change the position of element, attach it to any other element, pass the class and the style in parameters, you can delete it and you can update the content. But it is also possible to do more advanced stuff like creating any HTML element template and use them by referencing them. It should also be possible to do svg tags like that : myHTMLhandler:defineElement("svg", '<svg height="100%" width="100%">', '</svg>') then use myHTMLhandler:addElement("svg",myContentInsideTheTag) The defineElement and the addElement accept variadic parameters so there is in theory no limit Another example, to make this '<line x1="939" y1="537" x2="957" y2="519" style="stroke:rgb(1, 165, 177);opacity:0.7;stroke-width:3"/>' being encapsulated as an element you can do: myHTMLhandler:defineElement("svgLine", '<line ', '" style="stroke:rgb(1, 165, 177);opacity:', ';stroke-width:', '"/> ') local content = 'x1="939" y1="537" x2="957" y2="519"' local svgLineId, svgLineContent = myHTMLhandler:addElement("svgLine", content, 0, '0.7', '3') 0 being a default postion value, if you want to change the position in a list of element (see above for the table). '0.7' the opacity and '3' the strokewidth. now you can change the content by using (by default it will rebuild the HTML and display it as soon as the function ends) : myHTMLhandler:updateContent(svgLineContent, 'x1="0" y1="12" x2="37" y2="24"') Note that multi-content is only availible for table for the moment. others functions: addWindow(Anchor, Title, Content, TitleClass, TitleStyle, ContentClass, ContentStyle, Pos) -- to build a window with the NQ style setAutoDisplay(boolean) setAutoCompute(boolean) -- for big HTML structure you might want to turn them off as every time you add element or edit content the HTML is rebuild and displayed compute() --build the HTML display() --display HTML on all the "monitors" computeAndDisplay() --straightforward getElementHTML(Index) -- to get just a chunk of HTML could be used to display just a part of the structure somewhere else I am aware that there is other tool to build HTML. If you find a bug please report it. If you need help, ask me (same name on discord and IGN) or in the #lua-scripting discord channel If you make your own design using the tool, consider sharing Special thanks to @hdparm ps: I'll put images when the server works pastebin instead of file: https://pastebin.com/KuMRGFFp create a file "HTMLhandler.lua" and save it at the root of lua folder as below
  24. 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.
  25. OUTDATED. NOT UPDATED SINCE v0.23.0 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.23.0 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.23.0 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 and manual switches expose the same functions. The state is accessed using getState() and can be changed by activate(), deactivate() or toggle(). Emitter r0.23.0 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 container r0.23.0 Gyro r0.21.2 Industry r0.23.0 Item container r0.23.0 Library r0.21.2 Light r0.23.0 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.23.0 Screen r0.21.2 System r0.23.0 Telemeter r0.21.2 Warp Drive r0.23.0 Weapon r0.21.0
×
×
  • Create New...