Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
MrabEzreb

How to run do something when the computer's energy drops below a certain level

Question

I currently have a tier 1 everything, powered by a stirling engine.

The stirling engine gets hot and burns out

I want to stop that

I have a redstone card in the computer, and I thought, "hey, what if I made the computer control it's own engine!"

so I tried, and failed, many, many times.

Things I have tried:

  • Using an autorun.lua file in the root directory
  • Using a coroutine within said autorun.lua file
  • using RC (the little bit that I could figure out, which was basically nothing)

all of these things had the same problem: they run as the main thread, meaning that the computer is unusable whenever it is running.

 

My next idea was to use events, but there's a problem there too, I don't see any "power_changed" events.

 

What do you wonderful humans (sorry if you aren't human, I guess that's very inconsiderate of me) think that I could do to make this work?

 

Thanks in advance.

Ezreb out.

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

 

process.load(path:string[, env:table[, init:function[, name:string]]]):coroutine

Loads a Lua script from the specified absolute path and sets it up as a process.

It will be loaded with a custom environment, to avoid cluttering the callers/global environment. This environment will have access to anything in the specified environment, or the default (top level) environment if none is given.

(since OpenOS 1.6) path can also be a function, in which case env must be nil.

If an init function is specified, that method is called the first time the resulting coroutine is executed, and run before the actual program is started. This allows fine-tuning of the programs environment.

If a name is specified, that is the name the process will specify in process.running. It will be nil otherwise.

http://ocdoc.cil.li/api:process?s[]=process

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.