Lua Build Series - Digital Throttle - Stormworks

Lua Build Series - Digital Throttle - Stormworks

Building a Digital Throttle

Overview: In this episode, the speaker will show viewers how to build a digital throttle using Max. The speaker will go through all the components and logic needed to build the throttle, and then test it in the world of Snow Monks.

Components Needed

  • Battery
  • Screen (2x2)
  • Doll

Building the Market Processor

  • Create a new market processor and set it to 2x2
  • Add three nodes: composite from touch screen, output video, and output number for throttle
  • Add Lua script to draw a white line on the left side of the screen (10px from top, 10px from bottom)
  • Call the market processor "On Screen Throttle"
  • Place the market processor onto the creation and connect the video and composite

Adding Logic

  • Add logic to detect when the line is clicked
  • Add logic to calculate the percentage of the throttle based on the click position
  • Add logic to output the percentage to the doll

Testing the Throttle

  • Test the throttle by clicking on the line and observing the doll's movement
  • Ensure that the throttle is working correctly and that the doll moves between 0% and 100%

Adding a Dowel to the Screen

Overview: This section covers how to add a dowel to the screen using a red button.

Creating a Rectangle

  • Set the color of the rectangle to red (200, 0, 0).
  • Set the width of the rectangle to 5 and the height to 3.
  • Place the rectangle at 10x and 54y to center it.

Getting Inputs from the Touch Screen

  • Use input X (channel 3) and input Y (channel 4) from the touch screen to control the height of the button.
  • Use a memory register to save the number from the touch screen.
  • Use a read number to read the number from the touch screen.
  • Use a set to save the number from the touch screen.
  • Use a write number to feed the composite back into Oliver.

Limiting the Button's Movement

  • Use a clamp to limit the number from the touch screen between 10 and 54.
  • Update the script and spawn it in.
  • Use a button to draw the rectangle.
  • Press done and set the reset value to the bottom of the line (54).
  • Clamp the number from the touch screen between 10 and 54.

Throttle Control with Lua Scripts

Overview: This section covers how to limit someone from pressing anywhere on the screen and how to read a throttle number using Lua scripts.

Limiting Screen Presses

  • Use the point_rectangle block to set the dimensions of where someone can press on the screen.
  • Add three buttons at the top of the script to read where someone is pressing.

Reading Throttle Number

  • The throttle number is going from 54 down to 10.
  • Use two function blocks to convert the number into a percentage from 0 to 100.
  • Subtract the starting point (54) from the height (44) and divide by 44.
  • Multiply the result by 100 to get the percentage.

Introduction to Lua Scripting

Overview: This video provides an introduction to Lua scripting, a programming language used to create digital throw switches.

Creating a Digital Throw Switch

  • Press the "Lua Script" button to begin creating a digital throw switch.
  • Utilize the help menu to find the necessary memory registers and function blocks.
  • Link to the workshop in the video description for a downloadable version of the script.

Conclusion

  • Provide feedback on the video and suggest topics for future videos.
  • Thank viewers for watching and provide a conclusion.

Turn any video into a summary like this

YouTube links, meetings, lectures — with transcripts, search, and chat.

Video description

Join MrNJersey where he shows you how to create a digital throttle with LUA in the 6th episode of the LUA Build Series. NJ LUA Digital Throttle Workshop Link: https://steamcommunity.com/sharedfiles/filedetails/?id=2138401161 👨‍👩‍👦‍👦MrNJersey Gaming Offical Discord Server: https://discord.gg/zhZj3dh 👕MrNJersey Gaming Offical Merch: https://tspr.ng/c/nj-gaming-official-merch 🐦MrNJersey Twitter: https://twitter.com/MrNJersey 🧡MrNJersey Patreon Page: https://www.patreon.com/MrNJersey STORMWORKS: BUILD AND RESCUE Join a world where you design, create and pilot your own sea-rescue service. Release your inner hero as you battle fierce storms out at sea to rescue those in need. Stormworks: Build and Rescue is a rich and dramatic physics playground. Take your custom-designed, block-based and programmable vehicles into fierce oceanic storms. Plan and execute thrilling rescues in a variety of challenging crisis scenarios. Export and share your meticulously designed vehicles and missions with other players via the Steam workshop. Stormworks: Build and Rescue - create, rescue and release your inner hero! Stormworks: Build and Rescue - Create, Rescue and release your inner hero! Workstation & Gaming PC: https://www.amazon.co.uk/shop/mrnjersey?listId=Optional%5B1YK3RN90JAXG5%5D&ref=idea_share_inf Audio Setup: https://www.amazon.co.uk/shop/mrnjersey?listId=Optional%5B2DFP4F4912NLJ%5D&ref=idea_share_inf Please note that links above are affiliate links -- clicking them earns me a small commission if you make a purchase and helps support my YouTube channel. Thank you! Intro Audio: Holy Tension Batman (YouTube Audio Library) Series Audio: Night Snow (YouTube Audio Library) Outro Audio: They Might Not - Puddle of Infinity (YouTube Audio Library) #MrNJersey #LUA #Stormworks