This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Andale's profile picture

[Fix In Future Realease/known Issue] Command Blocks Double Or Backwards Chatting

Started by Andale, 23 January 2013 - 04:12 PM
Andale #1
Posted 23 January 2013 - 05:12 PM
I hate to post another topic but I get crap for asking unrelated questions in topics I've started.

As you can see in the photo, when the sleep commands are removed it prints the chats backwards and ignores the first one.
With them in place it only printed the first one, twice.
I'm noticing a trend of chats being doubled but commands work ok except they all seem to activate on setCommand without the runCommand.


Spoiler

local cmd = peripheral.wrap("right")
local function run()
cmd.runCommand()
end
local function clear()
term.clear()
term.setCursorPos(1,1)
end
clear()
print("The command block functions timer for Prot3ch")

-- Do the important stuff first!
cmd.setCommand("/gamerule doFireTick false")
run()

-- Lottery Timer
-- 10 minutes after every server restart 'give at random'
local Lottery = os.startTimer(600)

-- The IRC Chat
-- Displays every 20 minutes
local IRC = os.startTimer(30)
-- Reminder of the Forum Link

while true do
local event, p1 = os.pullEvent()   -- wait for pull event, assign "timer, title"
if event == "timer" and p1 == Lottery then  -- check which timer
  cmd.setCommand("/give @p 46 1")   -- lottery
--  firstTimer = os.startTimer( 10 )  -- timer reset (not used for lottery)
elseif event == "timer" and p1 == IRC then  -- check which timer
  cmd.setCommand("/say Thanks for playing on Prot3ch! We hope you have a great time!")
  sleep (0.1)
  cmd.setCommand("/say Ask questions at the IRC http://tinyurl.com/awfrqar")
  sleep (0.1)
  cmd.setCommand("/say Post about your builds at http://profserve.enjin.com")
  sleep (0.1)
  cmd.setCommand("/say Check the latest server news at profserve.blogspot.co.uk")
  sleep (0.1)
--  cmd.setCommand("/say Report problems with griefing/theft/glitches at /warp Report")
secondTimer = os.startTimer(1200)
-- elseif event
end
end


-- TEST ZONE -----------------------------------------------
--cmd.setCommand("/w @p Success!")
--cmd.setCommand("/give @p 1 1")


ChunLing #2
Posted 23 January 2013 - 05:23 PM
Yes, Cloudy mentioned in another post that they are going to fix the way command blocks work in the next update ("Already fixed", but that doesn't magically alter the current release).
Andale #3
Posted 23 January 2013 - 05:28 PM
Yes, Cloudy mentioned in another post that they are going to fix the way command blocks work in the next update ("Already fixed", but that doesn't magically alter the current release).
Oh thanks. Ok. I tried to google about and just got a lot of questions or garbage. I'll hold off on the peripheral usage then.
(YAY! I wanted to use bundles anyways.)

I'm thankful that someone told me it works with peripheral, just wish he'd mentioned that part :)/> Oh well, got my answer.

Seriously, best MC mod forum I've been on.