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

Farkle Dice

Started by naxyr, 30 December 2012 - 11:42 AM
naxyr #1
Posted 30 December 2012 - 12:42 PM
Today I have finished my playable Farkle room, with the assistance of some CC and tekkit bits. The video can be found at : http://youtu.be/kdTuu87C7b8


My scripts can be found here:

http://dl.dropbox.com/u/2934189/dice.zip

Each Screen is a 3x3 with it's own consol to represent each di, with the consol being underneath the screen parts. Redstone is piped into the back to cycle/roll the dice.

My startup for the Di computer looks like:

local roll1 = 1
local roll2 = 2
local roll3 = 3
local roll4 = 4
local roll5 = 5
local roll6 = 6
local randomnumber = math.random(6)
if randomnumber == roll1 then
shell.run ("monitor", "top", "one")
elseif randomnumber == roll2 then
shell.run ("monitor", "top", "two")
elseif randomnumber == roll3 then
shell.run ("monitor", "top", "three")
elseif randomnumber == roll4 then
shell.run ("monitor", "top", "four")
elseif randomnumber == roll5 then
shell.run ("monitor", "top", "five")
elseif randomnumber == roll6 then
shell.run ("monitor", "top", "six")
elseif redstone.getInput("back") then
shell.run ("monitor", "top", "shutdown")
end




each number thereafter looks something along the lines of:


while true do
write "#————————-#"
write "|…..###………###…..|"
write "|….#####…….#####….|"
write "|….#####…….#####….|"
write "|….#####…….#####….|"
write "|…..###………###…..|"
write "|…………………….|"
write "|…………………….|"
write "|…………………….|"
write "|…………………….|"
write "|…………………….|"
write "|…………………….|"
write "|…..###………###…..|"
write "|….#####…….#####….|"
write "|….#####…….#####….|"
write "|….#####…….#####….|"
write "|…..###………###…..|"
write "#————————-#"
if redstone.getInput("back") then
os.reboot ()
end
sleep (1)
term.clear ()
end
naxyr #2
Posted 30 December 2012 - 11:56 PM
I'm not even sure I need that last little bit of elseif redstone.getInput("back") then
shell.run ("monitor", "top", "shutdown") in the mother program for each di, that was just left over from prototyping I think.
The program 6 is also missing a "." for spacing still.
Okyloky9 #3
Posted 31 December 2012 - 05:51 AM
I'm not very good, but still, your dicegame has a way better gui than mine does ;p. Although, I would like to see you add a multiplayer feature maybe? Your di and the opponents di display on the monitor or something like that. :D/>
remiX #4
Posted 31 December 2012 - 08:54 AM
Your startup program can change into this size:

progs = {"one", "two", "three", "four", "five", "six"}
shell.run("monitor","top", progs[math.random(1,#progs)])
if redstone.getInput("back") then
    shell.run ("monitor", "top", "shutdown")
end
:P/>
Okyloky9 #5
Posted 31 December 2012 - 09:09 AM
I'm not very good, but still, your dicegame has a way better gui than mine does ;p. Although, I would like to see you add a multiplayer feature maybe? Your di and the opponents di display on the monitor or something like that. :D/>
I didn't watch the whole video, therefore making me look stupid. I just finished watching and I'm not sure if multiplayer is possible with it but I still think it would be cool.
naxyr #6
Posted 31 December 2012 - 01:44 PM
Your startup program can change into this size:

progs = {"one", "two", "three", "four", "five", "six"}
shell.run("monitor","top", progs[math.random(1,#progs)])
if redstone.getInput("back") then
	shell.run ("monitor", "top", "shutdown")
end
:P/>

very nice, much cleaner
naxyr #7
Posted 31 December 2012 - 01:46 PM
I'm not very good, but still, your dicegame has a way better gui than mine does ;p. Although, I would like to see you add a multiplayer feature maybe? Your di and the opponents di display on the monitor or something like that. :D/>
I don't know how to make multiple programs run on a monitor simultaniously yet, though I am sure it is possible
naxyr #8
Posted 11 April 2013 - 03:52 AM
I tried it out recently with the mod that is running in 1.5.1 and am having some difficulty. It does the first shuffle when one inputs redstone into the back, but then freezes up. Anyone got any bright ideas?