Jump to content




Program not functioning?


12 replies to this topic

#1 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 07 November 2017 - 10:14 PM

So I've been working on these for a while and I have everything the way I want it (I know there are much better ways to organize everything but I'll look into that later on). The only problem I am running into is that when I click the Remote option in my ClickMenu program it displays the remote program but the remote program doesn't actually function. The way the remote is supposed to work is it broadcasts different commands to a turtle and if you hit certain buttons it changes your screen to show more options. But it doesn't do any of that. I think it is because of the pullEvents I have for both programs but I'm not entirely sure. Below are the pastebins for the installer which has both programs if you want to test it out in game, and then the individual programs I'm talking about. I would really appreciate any help we're hoping to use this menu system on a server and I want every thing to be squeaky clean for when it goes live.

Installer:
https://pastebin.com/3JdVN9Tz

ClickMenu:
https://pastebin.com/HuZxiUFC

Remote:
https://pastebin.com/f39FWPcg

I should also mention that I do not get any errors during any of the programs listed. I also have another menu system that works with this perfectly. Instead of clickable buttons it uses just the keyboard. The install for that is here: https://pastebin.com/SPaBgXtV

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 07 November 2017 - 10:34 PM

Can you use the remote program by itself successfully? I rather doubt you can, as the program calling shell.run typically cannot affect the program called by it in any way*.

*There are exceptions to this, such as global variables.

Unrelated, but why do you have an exact duplicate of my stacker game on your pastebin? You should give me credit for my program at the very least, though I would prefer duplicates to not exist at all - simply point the installer to my pastebin.

#3 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 08 November 2017 - 03:10 AM

The remote works 100% on its own no difficulties and it works with the original menu system i made. I am only having trouble going from the clicking menu program to the remote. But every other program works with the clickable menu

The credit is given in my program, I only edited it so when I exit the game it reboots it or goes to the menu. I have a disclaimer in the menu system saying I did not write any of the coding and there are links to the original poastebins. I don't want to have to recode it everytime I install my menu program, its simply for convenience.

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 November 2017 - 03:30 AM

Well, I don't know what to say about that. shell.run does nothing different than typing 'remote' into the command line, especially since you aren't overriding any functions or running anything in a coroutine.

As far as credit goes, that's fine, but you shouldn't need to edit my script to do something after it is executed. Execution returns to the point in the script where shell.run after the program ends; the same effect could be added by simply modifying your own program instead of mine.

#5 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 08 November 2017 - 03:34 AM

Okay so that's why I'm asking a pro? I want to know if that can be fixed, how to override the current program and make it launch the remote program.

I'm not very good at ComputerCraft, nothing past the basics. It was easir for me to do it this way. If you're uncomfortable with me using your program I can take it down. The original pastebin is linked under the "Help" menu and it states I did not make the program. I can add your actual name if you'd like as well.

Edit: The menu system I am making is purely for a private server including a bunch of my friends. We're creating an arma like style of gaming server that we use computercraft a lot for and I wanted to make the computer program have more options and I thought adding games would make it so, rather than try to learn how to before the server goes up, I figured I'd collect a few and put them in a separate menu. The menu system is the standard program that will be used in specific classes that players can choose from but not everyone has access to the computer and its contents. Mostly, I will be using it so really it's more of a personal convenience and I don't have the time between work, college, internships, and life to learn more intricate coding to make it the way I wanted, this was just easier.

Edited by RobotBubble, 08 November 2017 - 03:37 AM.


#6 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 November 2017 - 03:47 AM

I've now downloaded both programs on separate computers in a (relatively) clean world.
I have a third computer listening for all rednet messages and printing them to a monitor screen.
I launched "remote" via each menu, and proceeded to press wasd (in that order) and compared the outputs on the monitor.
The outputs were identical, aside from the varying IDs (since the computers have different IDs).
This leads me to believe that the problem does not exist within your clickmenu program, and instead resides elsewhere. I can provide video evidence if you wish.
PS: I'm fine with you using my program, but give credit to the original creators of each program. The name and a link to the CC forums post of each program should be sufficient.

Edit: Besides this, there are some issues with your programs. For example, in "remote" you have a massive if/elseif chain ending with an "else" which runs the program again... this is called recursion and will eventually cause a java exception to be thrown.

Another issue is your use of rednet.recieve in remote. Before it will function, it expects to receive a response. I simulated this response by sending a random rednet message at it, simply to get past that point in the script. However, it would probably be a good thing to have a timeout on that which would indicate no turtle was found.

Edited by KingofGamesYami, 08 November 2017 - 03:53 AM.


#7 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 08 November 2017 - 04:06 AM

Regardless of your experiments the program works. I'll link you the pastebin for the TurtleRemote and I've tested it dozens of times, never getting an issue. I even recorded a video on it which I will also paste below. I don't know if you're using a different version of CC but everything about the remote works, as unorganized and porbably broken it may be it works the way I want it to. The click menu and the remote are two separate programs, I'm asking how to terminate the click program and then have it run the remote program.

https://www.youtube....F2PkSrcxY&t=49s

https://pastebin.com/187EGDBX

#8 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 November 2017 - 04:27 AM

The clients (either one) are sending the string "TS Refuel", whereas the turtle is looking for "TurtleRefuel". The source code of the offending programs proves this.

I think the click menu and non-click menu YOU are testing have differences in the version of the "remote" program you are using - one which sends the correct rednet messages, and one which does not.

Start a new world from scratch, run the installers, then tell me I am wrong.

PS: I am testing this in the Nightly build of ComputerCraft. However, I am confident this will not affect the results of these programs in this way.

#9 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 08 November 2017 - 04:58 AM

No you're running the incorrect program. Sorry this is my bad I should have explained. The Turtle has its own menu system, so to get everything running you have to run the TurtleInstall and the ComputerInstall and then click TurtleMenu and then Remote. The TurtleMenu on the original menu system I have gives you the chance to rename, refuel, and turn on/off autofuel on startup of the remote. Because TS Fuel is for the remote whereas TS Refuel is the Menu-Based function I believe, it was a way to differentiate the two and keep me organized as well as not clear any text or write any text on the actual Turtle Screen. And again, I know it is most likely overly complicated but it works the way I want it to.

SPaBgXtV is the ComputerInstall

If I did a bad job of explaining then the video I linked in a previous reply goes over exactly how to do this.

#10 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 November 2017 - 05:28 AM

I'm not really understanding what I've done wrong here. Here is the exact reproduction steps I used:
1. Place computer with modem on back
2. pastebin run SPaBgXtV
3. Place a second computer, again with the modem on back
4. pastebin run 3JdVN9Tz
5. Place wireless turtle
6. pastebin run 187EGDBX
Each computer asks me for a name, I enter some random data.
In the first and second computers, I navigate to TurtleMenu, then Remote (using keys and clicks respectively).
My rednet logger detects the messages sent, and notes that they are "TS Refuel". The source code of TurtleMenu on line 26, looks for a different string ("TurtleRefuel").

Poking around your pastebin, I found this script, which appears to send the correct messages. However, it is NOT installed by SPaBgXtV. According to pastebin, the script has been edited since the release of your youtube video.

Edited by KingofGamesYami, 08 November 2017 - 05:35 AM.


#11 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 08 November 2017 - 05:40 AM

Yeah I've edited it a bunch trying to add stuff. Here I will make another video really quick to show you. (I'm sorry this has been so difficult).

https://www.youtube....eature=youtu.be

The only difference between the coding you were using and the one here is that I just got rid of the TurtleMenu for efficiency. The Turtle will now use TurtleRemote as the startup. To be honest, I should just get rid of the TurtleMenu and implement it into the Turtle but that is for another day haha.

Edited by RobotBubble, 08 November 2017 - 06:09 AM.


#12 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 November 2017 - 02:41 PM

Reinstalled all programs, and I cannot replicate your issue with the click menu. Both the click menu and the non-click menu are able to control the turtle.

Spoiler



#13 RobotBubble

  • Members
  • 13 posts
  • LocationNew Hampshire

Posted 08 November 2017 - 03:04 PM

I am literally the worst problem I’m so sorry. I forgot that I ran the Autofuel function and that the computer was waiting for a rednet message and i was running a different version of my turtle program and basically I’m an idiot and it just hit me. I apologize for wasting so much of your time but thank you for going through so much effort to try to help I really appreciate it. I’m the worst haha





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users