504 posts
Posted 01 May 2013 - 03:26 PM
Hello Minecrafter,this time i give everybody the chance to make their own program without knowing any lua commands at all. Neat? I hope so. Select from the basic commands, up to commands from other mods to create your own program.SMART PROGRAMMER BETA VERSION 0.2.1Pastebin3T0cBtKiFeatures:- Simple menu; keyboard controlled- Create own programs with common turtle interactions without knowing the lua command- Run your own program in a loop to transport items or make an own tree farm and so on- append and add allready existing programs to your new one -> re-use code- add own commands even from other mods/apis/peripherals
- turn Live Tracking on and off
Installation:Label your turtle to let it save the programs and save files.label set <name>
Put the code in a text document without ending in …yourMinecraftDirection\mods\ComputerCraft.zip\lua\rom\programs\turtleOr if you are running a server you have to put it in …yourMinecraftServerDirection\mods\ComputerCraft.zip\lua\rom\programs\turtleRestart your Minecraft Client or Server (or both)Or you can use the simple pastebin import. Simply type the following words into your turtle.pastebin get 3T0cBtKi startup
How to use:If you downloaded the program, start it with the name you gave it (e.g. startup). You will find yourself in a small menu with at the moment three possible selectable programs.D or Enter — Open up submenu or start programW or Up-key — Select menu point aboveS or Down-key — Select menu point belowA or Backspace — Go back to the menu before or exit the programCreateSelect this if you want to create a new program. Press the numbers 1-6 to switch between the menus.By pressing specific keys you add an action to the program. If Live Tracking is enabled, the turtle will make the added action (e.g. moving 5 blocks forward). This helps keeping the overview. Be sure the turtle has fuel in it to be able to move.The Overview Menu shows you the last 8 actions you added to your program, but you also can delete the last actions.By adding an allready existing program, you import a program and append it to the program you are creating.You also can add own commands, but be sure that the command is written correctly and works. Please double check every time!If you finished your program, go back to the first menu, press Enter and give your program a name. Be sure the turtle can run the program in a infinite loop over and over again.StartIf you have created at least one program, you can choose from this menu one of them. Use the keys W and S or Up and Down to select one of your programs. Start with D or Enter or go back to the menu with A or Backspace.If you selected a program it will run forever, so be sure that the turtle will refuel at some point or stop in front of something if you think it can be shutdown.If the turtle gets shutdown in an unloaded chunk it will start again where it was left.If you want to stop the turtle from working, you have to hold STRG + T until the program gets terminated and then write the following command. delete Savepoint
Then you can start the program again (with e.g. startup) and get into the main menu to create, start or delete a program.DeleteDeletes a program out of your list.
Advanced knowledge: It still exists in the turtle's folder. You can redo the delete by adding the name of the program in the file "listOfRoutes" in the turtle's folder.
To-Do:- add if-statements
- most actions dont get redone if an action gets deleted (except redstone output at the moment)Updates:Spoiler
Beta Version 0.2.1
- fixed bug; now turtle can go up
Beta Version 0.2.0
- added delete option
- added sleep command called wait
- added the possibility of adding own commands
- added the possibility of adding allready existing programs
- improved menu and submenus when programming a program
- improved Live Tracking: Now can be turned off and on while programming Found a bug, got an error or something didnt worked?Something is strange or you even get a error message, please fill in this following layout and post it in this post:FTB Version:Singleplayer or Multiplayer:Error Code:What happened:This is helping me a lot to simply find where your problem is and hopefully how to fix it. If you get an error please write it down too. Mention which programs you where using and what/how many items in the turtle and chests were.More programs made by myself:ULTIMATE WOOD CHOPPER — Set up a farm to chop wood or cut down single 1x1 or 2x2 trees.Items Sorting Turtle — Set up a sorting layout with chests and let it sort items for you. Perfect for Quarries!Turtle Interactions - Simply naviagate the turtle with a menuTwo High Door - Opens one or more two high doors over rednet.Facebook:https://www.facebook...362726857167297That's it! I hope i didn't forget anything. Btw, my english isnt the best :/Because the program is still in beta i cant say that it is bugfree!If there are any questions, suggestions, errors or bugs, feel free to leave a comment to improve this program pack.Thank you for your attention.UNOBTANIUM
98 posts
Posted 03 May 2013 - 12:54 AM
This looks interesting, I will give it a look and see what it can do. I will be back with questions but if I can do more complex commands without needing to learn LUA, I would be very happy.
I am curious though, can this wrap a peripheral and use those commands? I am also interested if this can allow me to detect items in an inventory and then drop those items into a chest in the programs current state. Any way…test test.
504 posts
Posted 03 May 2013 - 08:27 AM
It is very basic at the moment and cant handle special commands. But if someone want to see them in this pack i will add them.
620 posts
Location
Holland
Posted 03 May 2013 - 12:38 PM
Pretty cool I think…
98 posts
Posted 04 May 2013 - 03:45 AM
FTB Version: MindCrack
Singleplayer or Multiplayer: MP
Error Code: 463 Attempt to index ? (a nil value)
What happened: I started a new program with tracking inabled. The very first thing I chose was refuel and selected 32. The error was returned after hitting enter on the value.
504 posts
Posted 04 May 2013 - 06:20 AM
I didnt added a detection yet, if the input of the player is a number or a string. So try not to tipe in some letters.
However i cant redo your problem in any way. Does it happen every time?
98 posts
Posted 04 May 2013 - 02:21 PM
Yes it does. I should note that I was doing this on a computer and not a turtle.
504 posts
Posted 04 May 2013 - 02:27 PM
Well. You cant refuel a computer, right? This program is for turtles. I tought that was clear :/
edit: I checked my post above and there was a computer mentioned in the installation part. I removed it (it was copy-pasted from another post of mine; copy-paste allways bad idea…)
98 posts
Posted 05 May 2013 - 12:19 AM
Well. You cant refuel a computer, right? This program is for turtles. I tought that was clear :/
edit: I checked my post above and there was a computer mentioned in the installation part. I removed it (it was copy-pasted from another post of mine; copy-paste allways bad idea…)
True, the program is for turtles. But there is a benefit to also being able to develop the program in a computer where it is safe and then apply that to a turtle in the field. So…it may be prudent to have a sort of simulation mode…if possible.
Any way it is not always a bad idea to copy paste as it can bring up additional ideas and thoughts for a given project. :-) There are always different perspectives in how things are read and applied. So…being too specific can harm the end goal sometimes. Any way, that is my experience.
504 posts
Posted 05 May 2013 - 06:33 AM
If you turn Live Tracking off on a computer, you should be able to program a program for a turtle. Live Tracking just let the turtle make the given action. And because a computer cant move or anything else a turtle can do, it give a error message out.
98 posts
Posted 05 May 2013 - 05:46 PM
Well then, it is something to explain or work on…may be a warning with the Live Tracking. After all if this is for us lay people out there. I would be happy to help work out any wording if you need it.
33 posts
Posted 06 May 2013 - 03:58 AM
I haven't tested your script yet but I had a similar idea of writing a short syntax compiler . I mainly wrote it because I often get annoyed by lua coding. I eventually wrote a simple
preprocessor that reads a
file with #define and then convert a file with 3 letter commands into the corresponding function call. The simple parser can only handle substitution macros but I know a way to make it parametrized macros.
I think I have a more updated version of the macro file at home but it's not even close to be ready for release. I want to also make a "twin version" in JS to allow writing scripts outside of minecraft.
My script is not really designed for the beginner it's more geared toward annoyed programmers like me or an alternative for the lua command in the shell. I'm not sure if I can make it beginner friendly . I use a simple syntax of <obj><action><direction> which may be confusing to newbies without knowing the API.
504 posts
Posted 06 May 2013 - 06:45 AM
I just quickly look over the code. It's quiet a lot and confusing :s
You know that you can save a command like turtle.forward() in an array action[1] = "turtle.forward" and then execute this command with loadstring(action[1])()
local action = {"turtle.forward()", "turtle.back()"}
loadstring(action[1])()
loadstring(action[2])()
This lets the turtle go one block forward and one backwards. For the Smart Programmer i didnt used that, but i might change it, because it is a lot easier to handle.
I am looking forward what you are going to come up with.
For everybody else: Version 0.2.0 is up. Enjoy!
7508 posts
Location
Australia
Posted 06 May 2013 - 06:48 AM
I just quickly look over the code. It's quiet a lot and confusing :s
You know that you can save a command like turtle.forward() in an array action[1] = "turtle.forward" and then execute this command with loadstring(action[1])()
local action = {"turtle.forward()", "turtle.back()"}
loadstring(action[1])()
loadstring(action[2])()
Using loadstring can be bad though, and it is inefficient for the purpose you're using it for… you should store and call the function pointers.
local action = { turtle.forward, turtle.back }
action[1]()
action[2]()
504 posts
Posted 06 May 2013 - 07:08 AM
And what does loadstring now?
edit: Does something work like the following as well?
local action = "turtle.forward"
action()
2 posts
Posted 11 May 2013 - 03:47 PM
FTB Version: im in 1.4.7 and the turtle vers. (i thinks is 1.5) (that say when ''shell()'' is runned)
Singleplayer or Multiplayer:SinglePlayer
Error Code: attempt to compare nil with number
What happened: i just wanted to my turtle go one block up, but i writed 1, (1), one block, 1 block, and everytime say that error code, pls teach me how to move the turtle just one block up :D/>
504 posts
Posted 11 May 2013 - 03:58 PM
Wow. That those bugs are appearing days after release and everybody is too lazy to send me a message… thank you. I fixed it and should be doing okay now :D/>
65 posts
Posted 27 August 2013 - 04:57 PM
Use peripheral.getMethods(side) for peripheral interaction. It returns a table with all methods allowed.
500 posts
Posted 31 August 2013 - 11:08 PM
And what does loadstring now?
edit: Does something work like the following as well?
local action = "turtle.forward"
action()
No but you could do this:
local action = {"forward", "turnRight", "turnLeft"}
for i, v in ipairs(action) do
turtle[v]()
end