←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

poll program

hawkwand's Photo hawkwand 14 Jan 2017

So I'm trying to make a poll program where player get on the computer it tells them the poll number and the question, then below that it will have answer and quit



Poll 01

Question: What do you think of Minecraft?


[answer] [quit]



if they hit answer it will take them to a writing area where they can type up their answer, then his print and it will be printed.
the only thing is I don't know how to get it to where they can click on answer or quit and once there done and hit quite how to get it to go back to the beginning.

I'm also doing this on a server that does allow you to download programs off Pastebin and it is on tekkit lite which is version 1.4.7 of Minecraft,





So this is what i have so far


startup
shell.run("poll")


poll
term.setCursorPos(1, 1)
print("Poll 01 ")

term.setCursorPos(1, 3)
print("Question: what do you think of minecraft?")

term.setCursorPos(15, 10)
print("[Answer]")
term.setCursorPos(30, 10)
print("[Quit]")


Answer
shell.run("edit pollA")

Quit
shell.run("delete pollA")
os.shutdown()
Edited by hawkwand, 16 January 2017 - 05:13 AM.
Quote

Bomb Bloke's Photo Bomb Bloke 15 Jan 2017

Difficult to comment on how you might add that to your code if we can't see your code. What have you got so far?
Quote

hawkwand's Photo hawkwand 15 Jan 2017

Someone on the server gave me this program but I don't know what to do with it.

while true do
event, param, x, y = os.pullEvent()
-- x and y are mouse positions
-- if mouse is pos
-- get answer
-- else if is in pos B
-- break <-- this is exit
end
end
end
Edited by hawkwand, 16 January 2017 - 05:16 AM.
Quote

roger109z's Photo roger109z 16 Jan 2017

View Posthawkwand, on 15 January 2017 - 04:33 AM, said:

Someone on the server gave me this program but I don't know what to do with it.

while true do
event, param, x, y = os.pullEvent()
-- x and y are mouse positions
-- if mouse is pos
-- get answer
-- else if is in pos B
-- break <-- this is exit
end
end
end
you may want to try something simpler then working your way up to guis or look up a tutorial the code that your friend gave you basically just explains how to pull mouse clicks but it won't do anything unless you edit it.
Quote