-1

I run a successful Minecraft Tekkit modded server with computer craft on it.

I'm fairly new to lua and only know the basics, I'm trying to make a menu with pages to display the banned items list and rules list on. I've made a program with arrows that's optimized for advanced computers and monitors.

The code runs properly on my advanced computer but doesn't run on the monitor, when it shows and someone clicks the arrows it doesn't work either.

I just started using stack so I'm not sure on what to do, if you need any info please ask for it :)

The code: http://pastebin.com/gVtPeBCE

By the way I already tried using Mon.write and Mon = peripheral.wrap("top")

For those who don't have tekkit here is a computercraft emulator: https://goo.gl/J0dPq0

Ibrahim
  • 11
  • 3
  • 1
    Please include the code within the question itself (third-party links are subject to link rot). Also please describe your issue more; what happens when someone "clicks the arrows"? What is supposed to happen? – Colonel Thirty Two May 21 '15 at 14:13
  • If you actually ran the code perhaps you would know what the arrows are, other than that this code is 900 lines so it would take up a lot of space. – Ibrahim May 21 '15 at 14:38
  • 3
    Most people aren't going to start up Minecraft, create a new world, and download your code to run it and debug it for you. Please read [How do I ask a good question](http://stackoverflow.com/help/how-to-ask). – Colonel Thirty Two May 21 '15 at 14:40
  • You're right about that, if you have any lua knowledge you could really help out :) I've added a link to a small program, a computercraft emulator. – Ibrahim May 21 '15 at 15:39
  • You should try to localize the problem, however. If it's something to do with arrows, are you able to include ONLY the arrow section of the codes? The less someone has to dig through, the greater your chances are. We don't know what your code is supposed to do. You, however, do. We don't have time to take the entire car apart just to find out it's a flat tire, essentially. – Josh May 21 '15 at 15:41
  • @Josh Basically the code is supposed to consist of multiple pages that you can scroll through by pressing the '<' and '>' signs on the touchscreen/advanced monitor, the problem I'm having is that when my arrows are pressed, on the monitor, they do nothing, however when they're clicked on the computer they work seamlessly. **Essentially what I want is for the arrows to be clickable on the monitor.** I don't want the players to have access to the computer as they can crash/hack the server through it. Thanks for the helpful reply, I'm always looking for ways to improve my questions :D – Ibrahim May 21 '15 at 16:05

2 Answers2

0

I'm sorry to inform you that I haven't read through all of your code. But judging based on your description, I would say that it's likely one of three issues, not including incorrect syntax as a possibility.

Note: Your question is exclusively asking about the programs ability to run on a monitor while the emulator you link to only provides the desktop ComputerCraft computers.

Peripheral

Although you already stated:

By the way I already tried using Mon.write and Mon = peripheral.wrap("top")

I would like to clarify that you can, as a way to simplify the code transition, set the peripheral function table equal to the term variable. For example: term = peripheral.wrap(string_side).

Note: When you use this method, you shouldn't execute the program with the command:

> monitor side program.

You should instead run it as a normal program with no special treatment.

I.e. > program.

Incorrect Mouse Event Detection

Simply put, when using a monitor, you're not supposed to pull for a mouse_click event. You have to pull for a monitor_touch event instead.

while true do
  type, side, x, y = os.pullEvent()
  if type == "monitor_touch" then
    print("Monitor '"..side.."' has been pressed at "..x..", "..y.."!")
  end
end

Monitor Size

This just simply means that the program you're trying to execute on the monitor takes up to much space and is therefore unusable when displayed on that size of monitor.

Suggestion: Either update your code for the monitor size or build the monitor to fit the program.


Please remember that all of these ideas might not answer your question, as the code you have provided to look over is too large and I haven't been able to find the time to experiment with it. Therefore, these are only general suggestions.

Tankobot
  • 1,492
  • 14
  • 21
0

if i had to guess, it's because term is short for terminal and will auto work with computers so if you set term to be the monitor at the top of the file it should work correctly.

term = peripheral.wrap("SIDE OF MONITOR")

Put that at the top of your code and it should work. but this what i think it is after taking a look at your code (also its not that long of a code sample...)

Alan Doyle
  • 98
  • 16