Jump to content


qwerty

Member Since 28 Feb 2017
Offline Last Active Jul 26 2019 04:19 AM
-----

Posts I've Made

In Topic: passing parameters to running program with read()

25 July 2019 - 08:49 PM

My nogin's been jogin all day long and i hadn't even considered that...
I'm sorry for your hassles and forever in your debt.
Thank you for your help.

With regards and utmost gratitude,
-qwerty

In Topic: passing parameters to running program with read()

25 July 2019 - 04:48 PM

well if you insist...

term.clear()
term.setCursorPos(1,1)
local oldBgC = term.getBackgroundColor()
local BgC = colors.red
local sOut = false
local w,h = term.getSize()
--defining button color
local out = rs.getOutput("bottom")
if out then
BgC = colors.green
else
BgC = colors.red
end
--button "write"
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(2,2)
term.setBackgroundColor(BgC)
term.write(" ")
term.setBackgroundColor(oldBgC)
--button "handeler"
local function btev()
while true do
  local event, mb, x, y = os.pullEvent("mouse_click")
   if x == 2 and y == 2 then
   sOut = not out
  end
   rs.setOutput("bottom",sOut)
end
end
--exit "handeler"
local function exit()
while true do
  term.setCursorPos(1,h-2)
  term.clearLine()
  term.setCursorPos(1,h-1)
  term.write('type "exit()" to exit')
  term.setCursorPos(1,h)
  if read() == "exit()" then break end
end
end
parallel.waitForAny(btev, exit)

expectations: button yealds untill exit yelds then code stops
vs,
reality: button yealds once then waits for exit to yeald

thats as simple as i can explain it, but if you wish not to reply i'mfine with that.

With regards,
-qwerty.

In Topic: passing parameters to running program with read()

25 July 2019 - 01:46 AM

Well yo jave helped me greatly, but unfortunately in my instance it still is ineffective as it does not Allow me to activate the button while reading.
That said, thank you for your contribution to my cause.
Further help apreciated but not necessary.

With regards,
-qwerty

In Topic: passing parameters to running program with read()

24 July 2019 - 04:08 PM

Thank you kind sir! I am genuinely ashamed i hadn't even atempted to turn them both into functions...
But i digress, without your help i may still be as confused as ever. Thank you for your help and keep up the good work!

With regards,
-qwerty

In Topic: passing parameters to running program with read()

24 July 2019 - 03:59 PM

Dis regard this, thought the previous didn't post.

With regards,
-qwerty