Menu code not working (not my code)

Started by AidenCodes, Mar 28, 2019, 03:45 am

Previous topic - Next topic

AidenCodes

Mar 28, 2019, 03:45 am Last Edit: Mar 28, 2019, 08:48 pm by AidenCodes
I'm making a big reactors controller that uses this menu that I found on YouTube, but I'm getting this error: window:179: bad argument: string expected, got nil.

I don't want another, better menu, the code I added worked fine until I added a forth option, and I quite like it.

(pastebin to my code: https://pastebin.com/qws68ntV )

EDIT: this is an older, working version: https://pastebin.com/9NEremDj

Dog

Mar 28, 2019, 11:31 pm #1 Last Edit: Mar 29, 2019, 12:49 am by Dog
Looks like you didn't add a shell.run("startup") to your fourth option (after sleep(2)).

Using shell.run("startup") is not a good way to restart the program, though, as you are running a new instance inside of the previous instance and keep stacking those instances until you will eventually run into a limit and the program will crash.

The easiest and most straightforward fix for this would be to replace all instances of shell.run("startup") with os.reboot() - that will restart the startup program properly.

AidenCodes

Sorry that was a left over from a previous test of this, but that's unrelated to the error I'm getting

AidenCodes


Dog

Please post the exact code you're using (not stuff that is left over from a previous test).
With the code you've posted, the only place I can see that might have introduced that error is your write call with react.getFuelConsumedLastTick().  Change that line to write(tostring(react.getFuelConsumedLastTick())) and see if that solves the problem.

AidenCodes

I did post the code, i mean the shell.run('startup') was a left over, everything else was new

That code didn't work :/

Dog

So, the code that you're attempting to run is exactly the same (line for line, letter for letter) as the code you've posted?

How did you get the code to pastebin?  Did you re-type it or copy/upload directly from the computer?

What happens if you run the 'old' version of the script (with 3 options) - does it work as expected?

Last, but not least - it 'didn't work' doesn't help me help you find the problem.  What *did* it do?  Did it do something different than last time or is it still producing the same error?

AidenCodes

1. Yes - except I've added your suggestions to the one on the computer
2. I used pastebin put
3. it works as expected
4. it returns the same error

Dog

Hmm...I don't see anything in your code that would cause that error.  Please re-upload the code as it is now and post the link here.

AidenCodes


Dog

For the life of me I can't find anything in your code that would produce that error.  I went through the code, cleaned it up, and reordered a few things.  If you don't mind, please try this version and let me know what happens.

What version of MC and CC are you using?

AidenCodes

Minecraft 1.7.10 (also using 1.7.10 pack on tekkit, not important though)
CC 1.7

Your code worked, but i couldn't click/select.

Dog

OK, found the problem - the y position wasn't being rounded up or down when creating the buttons - so their y values were values like 7.5 which you can never click.  Try this, it should work as expected.

AidenCodes

The program almost works, but the problem is something I am able to fix :D Thank you >u<