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

Help Pro

Started by karadeli, 11 September 2013 - 12:32 PM
karadeli #1
Posted 11 September 2013 - 02:32 PM
I am make a copy of direwolf20 's aurey game it is almost done But it has problems please !!!!


Code: pastebin.com/GJVWy18S



HEEEEEEEEEEEEEEELP!!!!!!!!!!!!!!!!!!!!!
jay5476 #2
Posted 11 September 2013 - 02:58 PM
this is a monitor thingy… but anyway I have fixed your code up

-- A ComputerCraft program for a match scoreboard (ex. Handball match), to keep track and show the crowd the result
-- Couldn't figure out how to use "print" instead of "write" cause it would have looked better...
-- You can freely modify this code as you wish :)/>/>
-- Author: BobbyB33
x1=0
x2=0
while true do
  mon=peripheral.wrap("right")
  mon.clear()
  mon.setCursorPos(8,1)
  mon.setTextScale(1.5)
  mon.write("SuperForm  "..x1)
  mon.setCursorPos(8,5)
  mon.write("Karprensi   "..x2)
  input=read()
  if input=="h" then
	x1=x1+1
  elseif input=="a" then
	x2=x2+1
  if x2>=5 then
	mon.clear()
	mon.setCursorPos(8.4)
	mon.write("Winner is Karprensi")
  end
end
first of all x2=5 needed to be x2==5 (I do >= so it checks five and above) because it is the comparison operator x2=5 would set it to 5 but in this case it would error
then you have your If statement and elseifs wrong they need to be in the same block of code

--example that works
if a==1 then
--some stuff
elseif a==2 then
--other stuff
end
that checks the first statement then if its not it goes to the elseif this is the example that wont work

if a==1 then
--some stuff
end
elseif a==2 then
--stuff
end
so your elseif at the bottom would be in no code block a normal if statement would do because if its elseif it will only check after everything else has failed if that fails it goes to the else statement
one last point if you want to you can redirect to a monitor using term.redirect and use print etc. on the monitor :)/>
PixelToast #3
Posted 11 September 2013 - 03:38 PM
the title sould be description of your problem, dont just say help
putting explanation marks and "HHHHHHEEEEEEELPPPPP" wont make us help you any faster

direwolf is not a good coder at all, its not a good idea to learn from his style of coding
you sould always localize
and usually you want to redirect and not run just monitor functions, this allows you to use print:

term.redirect(peripheral.wrap("top"))
print("Hello world!")
term.restore()

input=read()
if input=="h" then
x1=x1+1
elseif input=="a" then
x2=x2+1
if x2>=5 then
mon.clear()
mon.setCursorPos(8.4)
mon.write("Winner is Karprensi")
end
end
syntax error much? you want to put an end before "if x2>=5 then"

  elseif input=="a" then
    x2=x2+1
  end
  if x2>=5 then
karadeli #4
Posted 11 September 2013 - 03:57 PM
this is not work :(/>
LBPHacker #5
Posted 11 September 2013 - 05:11 PM
Error message. Nobody's gonna help you unless you provide an error message. Or something we can actually help with. Real life doesn't work like "hey, I have problems with this, help mi fix this crap!".
Sora Firestorm #6
Posted 11 September 2013 - 11:15 PM
Error message. Nobody's gonna help you unless you provide an error message. Or something we can actually help with. Real life doesn't work like "hey, I have problems with this, help mi fix this crap!".
That's almost pefectly said. You want help faster? Then help us help you.
immibis #7
Posted 12 September 2013 - 07:11 AM
this is not work :(/>
i have same problem. plz email me teh codez.