This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Parmacoy's profile picture

Parmos - User-Friendly Program, Api Available

Started by Parmacoy, 10 June 2013 - 07:15 PM
Parmacoy #1
Posted 10 June 2013 - 09:15 PM
ParmOS V2 - 4th Iteration (Don't Ask)

API
SpoilerThe latest revision of my program saw me splitting common program features into a sub-API which is usable over many different programs

pastebin code : fcEn6qgf
  • Feature List
    • cls() - Clear Screen and Set Cursor to the start
    • saveTable(filename,data) - Saves Specified Table
    • loadTable(filename) - Loads Table
    • uploadTable(id,table) - Sends table information over rednet
    • setSpace(msg) - Used for my basic GUI's, thats what creates my formatting like so "|| Parmos V2"
    • setTitle(msg) - Sets the Title for the pages
    • checkLabel - Checks if computer has a label, if not, prompts you to enter one
    • title() - Prints title with the setspace like demonstrated above
    • inputNUM(msg) - Validates an input if its a number, if not, asks again
    • inputYN(msg) - Validates a y/yes|n/no input, if not, asks again
    • inputSTR(msg,str1,str2) - Asks you to pick one of the two options defined by str1 and str2
    • up() - Turtle Up
    • down() - Turtle Down
    • forward() - turtle forward
    • back () - turtle back
    • digMoveForward() - keeps digging forward until it can move forward
    • digMoveUp() - keeps digging up until it can move up
    • digMoveDown() - keeps digging down until it can move down
    • dig(delay) - Digs forward, sleeps for delay, if block still there, repeats
    • digUp(delay) - Digs up, sleeps for delay, if block still there, repeats
    • digDown(delay) - Digs down, sleeps for delay, if block still there, repeats
    • digUpForward(delay) - Does the same as digUp and Dig but it combines them both and checks
    • digUpDown(delay) - Does the same as digUpForward, but different directions
    • digAll(delay) - Combines all three checks
    • posRotate(dir) - parses string input, if string equals right, turns right, if string equals left, turns left
    • negRotate(dir) - parses string input, if string equals right, turns left, if string equals left, turns right
    • dropSlots(first,last,side) - drops slots, starting at the first, up to last, with a side, which can be up,down,front
    • pbGET(code,filename) - My Own GUI less pastebin grabber
    • dbGET(userNumber,code,filename) - My Own dropbox file grabber, specify user number, then the code, then specify the name of the file to save as
    • sendTable(id,table) - Sends table to a rednet ID
    • loadSTR(filename) - Retrieves all text contained within a file
Installation

Simply place down your computer / turtle, right click on it to bring up the computer window, then type what is in quotes, but where it says <program name>, that means you can call it UncleSam for all I care, just remember what the name is, as that is what you will need to type in to run the program

pastebin get 4M3pgDrM <program name>

Features
  • Extensive GUI for the basic user (computercraft illiterate persons)
  • Contains 2 Main programs to be run from main menu, along with 3 basic programs for ease of use, saves you guys learning the console commands, with intuitive prompts
  • Sub-Programs
    • Mine
      • Efficient use of fuel
      • Digs Either 1 layer(blocks on its level only) or 3 layers(1 Above, its level, 1 Below)
      • Definable Depth, work out how many blocks it will dig by multiplying the levels by the layers, eg 2*3 = 6 blocks deep
      • Drop Block Functionality, no longer do you have to check up on your turtle to empty the chest of all that pesky cobble!, just choose how many slots you want dropped, and then place one of each of the items you don't want collected in each respective slot, when its mining it will drop those useless items on the ground saving you your precious and highly coveted chest space
      • Place Torch Functionality - Places torches on the last layer of its mining job if you tell it to do so, handy for bedrock mining where it gets really dark and scary
      • Efficient gravel detection already implemented, no longer will turtles be broken due to gravel or sand interrupting their mining operation
      • Turtle will only return home as well if it thinks its inventory is full at the end of each line, or it has finished mining a layer, where it will return home, dump the items, then proceed to dig down if more layers are defined
      • Don't worry about your turtle crashing or dying mid-mine due to lack of fuel, a fuel calculation system has been implemented that tells you how much more fuel the turtle needs to do the job before it even starts! so you are pretty much guaranteed an uneventful mining operation while you do other stuff around your base
      • The program also supports uploading its information to a server if a) it has a wireless modem on it, and you have defined a server id to upload to
        • This will allow you to check up on your turtle without trying to find it if it is within wireless range of the receiving computer
        • If nothing comes through, its not of any fault of my program, there is a range limitation as can be found out here http://computercraft.&#46;&#46;/Wireless_Modem
      • I actually forgot about this last feature, haha, I added in an option to deposit into an enderchest rather than returning home, you place an enderchest, referring generally to modpack ones, rather than vanilla enderchests unless of course you have an auto chest clearer on the other end, it then places the enderchest above it when it needs to empty its inventory, then removes it when done.
      • Warning please, Yes there is a persistance function, no, it doesnt work properly, use at your own risk, also this means no leaving the vicinity, sorry, If you read how my program is structured you would too figure out that persistance is too tricky to make without remaking the whole program (again) from scratch (no way)(too lazy)(only interested in programming lua periodically nowdays, this change would require days of work)
    • Server
      • No longer do you have to check up on your turtles manually, using this simple program you can see the real time statuses of each and every turtle, of course only if using my program, would be silly and too inconvenient for me to implement a universal system now wouldn't it
      • Good News Everyone! you don't need a computer for this, you can actually configure another turtle with a wireless modem to be your server as well!, doesn't mean you can't use a normal computer though, just if you do, place a wireless modem on the right of the computer
      • Not to mention you can either use an external monitor for this program, or not, your choice, so get mining!!!
    • Refuel
      • Prompts you to fill as many slots as you can with fuel types
      • Fuel types can mean anything from wood!!! BURN BABY BURN!!!, to coal, charcoal, and depending on your modpack, say with IndustrialCraft 2 you can use batteries, or in fact lava buckets, if you have copious amounts of lava i would recommend this one, 1 bucket of lava gives your best friend the ability to travel 1000 blocks.
    • Update
      • Not much more to say about this, pretty straight forward other than it updates the program :P/>
    • Reset
      • Cleans all the stored memory data by the turtle, allowing you to start fresh, due to the way I have coded the programs this seems pretty defunct then, don't ask!!!
Changelog
29/08/2013
  • Fixed Torch Placing
  • Added in support for the server for the new datatype
  • Added Program "server"
  • General Tweaks to the code
Future Plans
  • None, other projects are requiring my attention, not to mention I haven't played minecraft in weeks now
ParmOS V1

Important Please Read

This program is not being updated anymore, so if you want to use this program, just letting you know its not supported, you cannot cross-use the two programs either, they are completely different, the newer being a complete rewrite, although if you want to use the tree program from V1, go right ahead, its perfectly bug free, lacks persistance though, but that program has had the most extensive testing of any, use it all the time for turning mindcrack 2x2 fir trees into charcoal with natural tree growth, needless to say i have ended up with over 640 stacks of charcoal without touching it…

Changelog
  • 11/07/2013
    • Added refuel sub-program
    • Added update sub-program (updates the whole program)
    • Added reset sub-program (resets all saved fields)
    • Added in option to the mining program to drop up to the first 8 inventory slots, whilst keeping one of every item in them
      • This allows for dumping of whatever you don't want to collect, E.G. setting it to 3, and putting cobble,gravel,dirt in first 3 slots so as to not collect them, instead they are dropped onto the ground
    • After a reset/fresh install of the program, it will no longer ask to send data to the server if the turtle has no modem
  • 10/07/2013: fixed turtle tree program destroying saplings when leaf block above it hence blocking movement
Current Bugs
  • Mining program hangs at random positions occasionally, unknown as to the cause, would fix if i knew the cause
Planned Features
  • Rewrite of mining program to use path of least fuel usage and also having automated refuel from the coal it mines
  • multi-layer mining
Description
This program has been a long running project, started when Feed The Beast first came out, and has been changing ever since.
The turtle program contains 6 sub programs with an easy to use GUI to navigate and quickly get information for the task the turtle is doing.
Since the initial program was made, it has gone through 3 complete rewrites to make it easier to use, and to natively support the new features I had been learning about in relation to ComputerCraft and LUA.
The program from my reckoning is complete as far as i am concerned with features, and it has been extensively bug tested, I hand out mining turtles to people on the Mindcrack server I play on.

Furthermore, When i wrote the third iteration, I designed it to be modular, and adaptable so that new programs can be added with ease without interfering with other programs. Feel free to go through my code, and adapt and or add new sub programs to it, same with the GUI, its entirely copy and paste-able with minimal changes being needed. Just please do give credit if you decide to use as I have been working on this for months. Thanks

Pastebin Links

Note: where there is <program name>, that means you can write anything there

Main Turtle Program
pastebin get zzTafMvn <program name>

Server
pastebin get 7k6ea0gh <program name>

If you need more help setting up the server please say so

Usage

After downloading the main turtle program onto the turtle, you will need to provide fuel for the turtle, simply run the main turtle program you downloaded, and run the program called refuel

Steps for mining turtle
  1. Type in "pastebin get zzTafMvn <program name>" into the turtle where <program name> is whatever you wish, this is the main program
  2. Type the name that you saved the main program as into the window
  3. Run the sub-program "refuel" and follow the on-screen prompts
  4. Since this will be your first time running it, if the turtle is a wireless turtle, it will prompt you to send data to the server
    • If you say yes to this prompt, please Follow Steps for server first to get needed information
    • Enter the ID you got from the server so that it knows to send only to your server computer
    • This means you can send realtime data to a server to be displayed on a screen
  • Since the turtle won't have a name/label associated with it, the program will prompt you to assign a name
    • This can be anything you wish, you can name your turtle anything Example, you can call your turtle "Steve"
  • The main program page will then show up with a list of all existing programs
  • Type in one of the displayed programs to run, then follow the GUI prompts to set the options
  • If it asks you a direct question which requires a yes or no answer, inputting either yes,y,no,n is acceptable
Steps for server
  1. Type in "pastebin get 7k6ea0gh <program name>" into the computer where <program name> is whatever you wish, this is the server
  2. Ensure that there are at least 2 high and 3 wide rectangle of monitors above the computer, whilst touching it
    • Generally 3 high,5 wide is a good size for that program
  • Ensure there is a Wireless Modem attached to the bottom face of the server computer
  • Type the following into the server computer where <program name> is the name that you saved the server program as
    • monitor top <program name>
  • The ID of the server computer will print to the screen, you will need to know that ID when setting up the Wireless Mining Turtles
  • Then refer to Steps for mining turtle
Sub-Program Features

Main
  • All the programs support uploading all their information to a server which the program I have created, which prints information related to the program running, and supports many turtles, I have tested up to 8 running simultaneously
  • All the programs save their data into a cfg. So in the case of the tree chopper, it will keep track of wood cut, trees cut, etc
Tree Chopper
  • Optional Tree Size 1x1 or 2x2
  • Optional to use bonemeal or natural tree growth
  • Selection, Either it can use vanilla chests, or the barrels from the Feed the Beast Modpack
  • Can Pause the program and wait for a redstone signal - this is configurable so that a redstone signal can either make the turtle go or pause, allowing to say log off or leave the chunks without breaking the program. IMPORTANT — Redstone Signal MUST come from underneath where the turtle returns, as its set to check Down.
  • Runs Indefinately as long as
    • The turtle has enough fuel remaining or the chest above it has fuel still
    • If the bonemeal option is enabled, then if there is bonemeal still there
    • That there are saplings remaining in the chest behind it
  • Tests I have done on the program before have yielded 1500 stacks of Fir wood logs, the giant 2x2 trees on Mindcrack - FTB without any intervention from myself from a few hours of leaving it chopping
  • Supports Variable Tree Height
  • Intelligently Manages it's inventory so that Items don't get mixed up in different slots
  • Has not bugged so far with many weeks of running
Miner
  • Returns to the starting location after every row to dump items into a chest that is placed directly behind its starting position
  • Can either mine its current layer (the layer its on) or 3 layers (the layer above it, the layer its on, and the layer below it)
  • Variable Length and Width, (Unless you have a large amount of chunks loaded, don't use 100x100 or else the turtle unloads)
  • Can Place torches beneath it as it goes along, with 7 block spacing between them
  • Outputs to the Server if setup
  • Is able to drop up to any 8 items, when set, place the items in the initial slots up to how many you set to drop
Farmer
  • Can set the amount of stacks of wheat to farm using bonemeal
  • Draws bonemeal from above it, and deposits wheat and excess seeds in a chest to its right
Refueller
  • Checks every slot in the turtles inventory for usable fuel
  • Refuels as much as possible from what is provided
Update
  • Once run, will automatically update the program to the latest version
Reset
  • Once run, will automatically reset all data
The above sub programs can be easily accessed through my concise GUI which has error checking and input checking so that programs can't be crashed by accident.

Images
SpoilerApologies for the images being links, I tried the BBcode image tag and it wouldn't let me

Turtle Setup - Tree Program - Chests
http://db.tt/8HdA8YZ3

Turtle Setup - Tree Program - Barrels
http://db.tt/2Aywix14

Turtle - Miner at Work
http://db.tt/oZJFQjQP

Turtle - Main Program Interface
http://db.tt/4KK1TRxo

Turtle - Tree program Options
http://db.tt/NwilaK4t

Tree Program Options Filled Out
http://db.tt/svS4iVw3

Turtle Server That Prints Information
http://db.tt/YEn3vEYP
NomNuggetNom #2
Posted 13 June 2013 - 02:19 PM
This is fantastic, amazing work! Can't believe nobody has posted yet. The only request I have is to have a mode where the turtle deposits everything into one chest next to it after planting four saplings.
Parmacoy #3
Posted 13 June 2013 - 06:56 PM
Deposits everything hmm. So in a sense, after it plants, it dumps slot 1 (Saplings), Slot 2 (Bonemeal) into the chest, then chops the tree. I'm not sure how that is any different to the current mode, as the current one chops the tree, plants the saplings, drops any saplings that makes the sapling stack not be a multiple of 4, turns left to the chest, and dumps all the wood whilst still keeping saplings and bonemeal in their appropriate slots allowing for fully autonomous work.

By the way, I GREATLY thank you for posting, was afraid my program sucked and nobody liked it :wacko:/>
I'm open for changes, just I will need more information on this one sorry :P/>
Skrymir #4
Posted 13 June 2013 - 07:51 PM
oh my i have been trying to make a tree chopping program for like 3 hours now thank you so much.
Parmacoy #5
Posted 13 June 2013 - 10:56 PM
No Problem :)/>
SWGCryand #6
Posted 23 June 2013 - 02:56 AM
What do you mean "server" for the pastebin? Does that have to go into the server or can it be individual? Like can I label set <label> and then pastebin that in there or does that *HAVE* to be installed to the server? Sorry if this question was vague -.-

Also, can you provide a screen shot of how to fill the inventory for each program? IE Treefarm. I attempted to set up and it showed that 64 coal coke = 64 saplings in the interface.
Parmacoy #7
Posted 24 June 2013 - 07:22 AM
Ok so, first of all, to get a program from pastebin it is as follows
pastebin get <pastebin code> <name to save the program as>
eg in that instance pastebin get 7k6ea0gh server
or pastebin get 7k6ea0gh ParmOS_server
as the program is a server for the turtles, also the inventory setup is nil

As long as you have the barrels / chests setup like in the images, the turtle automatically refills from them all
so in the tree program, it auto manages slot 1,2,16 which is saplings = slot 1, bonemeal = slot 2, 16 = fuel

If the turtle has no fuel whatsoever, place some fuel initially in slot 16, from then on, when it needs more fuel, it will get it from the chest/barrel above it
Its a pretty advanced program :)/>

Then in the case of the miner, slot 16 is torches
craigcon #8
Posted 06 July 2013 - 05:11 PM
The server program doesn't do anything for me, modem and monitor connected (Advanced computer and monitor) and it just locks up
Parmacoy #9
Posted 07 July 2013 - 04:59 PM
Hi craig, it does work, a few things you will need to do, as its a program not made with the best guide or GUI. You will need to get the initial server Computer ID, so when you turn the advanced computer on, type i think its in uppercase, "ID" without the quotes. Once you get that computer ID, write it down then the client program aka ParmOS MUST be setup with send data to server enabled, that is a one time question once you first run the program. Say yes to send data to server, then input the server ID you wrote down before.

Please note, the rednet modem MUST be on the bottom of the advanced computer or else you will have to edit my server program manually and change
rednet.open("bottom")
to one of the following sides top,bottom,right,left,front,back as stated in this http://computercraft.info/wiki/Rednet.open

Once you have done all that correctly, the program on run won't appear to do anything as it is waiting for rednet messages from turtles WITHIN range, once it gets a message it will update the server screen.
What I did in the picture of the server by the way is run a program called monitor, the exact thing I run is
"monitor top <program name>" which in my case is monitor top server.

If you have run into the problem of saying upload to server on initial run of your turtle, you will have to type in the main screen of the turtle, outside of my program
"rm ParmOS.cfg"
that will clear all saved data and allow you to start again
Thanks for your question!
bloatedwalrus #10
Posted 08 July 2013 - 04:19 PM
Hi, I just wanted to thank you for this program. It does exactly what I wanted it to do, chop down trees fast and efficiently. But I did notice one bug, after it comes down and deposits the logs and places the saplings, it starts destroying the saplings and then replanting them. Any idea why its doing this, or is it something I've failed to do.
Parmacoy #11
Posted 09 July 2013 - 05:57 AM
Hi bloatedwalrus, I'm afraid I haven't encountered the bug before, can you provide screenshots of your setup, and what slots you have put everything in, as by the sounds of it, it should not be doing that, I have extensively used said program over many server worlds before uploading, and in fact it chopped 1500 stacks of fir wood logs in one real life day of running without intervention, so I am at a loss as to why it would be happening.
Parmacoy #12
Posted 11 July 2013 - 01:25 AM
Worked on adding many new features and fixing many things today, quite a few things have changed
Parmacoy #13
Posted 22 July 2013 - 03:43 AM
Does no one have any suggestions for this, I can tell its not a popular program so what can i make to make it better and more interesting
Zolaron #14
Posted 23 July 2013 - 05:43 PM
Like this program but wanted to add a few things which kinda expanded into quite a lot. ill message you a link
Parmacoy #15
Posted 23 July 2013 - 07:13 PM
Thanks to Zolaron, i will be making changes to the program over time, which he will be duly credited, adding in extra functionality to many parts including persistance. If you read this, feel free to post on here, I appreciate people making my ideas better
Big_Honda #16
Posted 26 July 2013 - 09:51 AM
Just downloaded it to check it out, like the way you have it set up so far, gonna go have a play…
Parmacoy #17
Posted 27 July 2013 - 05:50 PM
Please note, the mining program has gone through a complete rewrite, if you want the miner only, new features are semi-persistant after restarts, depth mining, only returns to the chest if it needs to. etc etc

use this code

pastebin get 4M3pgDrM <program name>
scottrot1 #18
Posted 25 August 2013 - 09:02 AM
Hey parm, fancy this (i'm enderdragon054.) I was watching a youtube video and in the description there were links to turtle programs he used 2/3 being yours. These really are great programs and have helped me alot, with regards to fuel usage you could make the turtle have an ender chest in say slot 5, when it gets a full inv or finishes its job it places the chest above it places all ores/wood etc in it then continues which would save the fuel from going back and forth to the chest which would also speed the mining process up quite a bit. Also to all people having trouble with the server, it can only pick up turtles up to 64 blocks away but in a thunderstorm only 16 blocks away (at sea level) but at max altitude the range can be up to 384 blocks!
scottrot1 #19
Posted 25 August 2013 - 09:15 AM
Also could you create an option for the server to use terminal glasses?
Parmacoy #20
Posted 28 August 2013 - 10:44 PM
Few updates done today to my new program, after working on it for about 4 hours, im bored of it again, but changes made are, one program for server and turtle, detects whether its a computer or turtle, Mining program was tweaked and now torch placing works, proper persistance is too tricky to work out, so only the current one is in, it says incomplete so use at your own risk, a turtle can be a server now, it just needs a modem on the right, same with a computer, modem MUST be on the right, few other tweaks made, such as the mining turtle can now use an enderchest, it is an option. You place the chest in slot 15, and instead of returning home it will place the chest, dump in it, and break the chest.

As usual the code to get this program is

pastebin get 4M3pgDrM <program name>

If you have any bugs, please tell me so

Also the terminal glasses, would be too hard, besides the modpack i play on doesnt even have glasses. So thats a no sorry scottrot1
scottrot1 #21
Posted 02 September 2013 - 02:36 PM
Also the terminal glasses, would be too hard, besides the modpack i play on doesnt even have glasses. So thats a no sorry scottrot1

No problem, it was just an idea, thanks for the update and keep up the great work :D/>
Narethian #22
Posted 10 September 2013 - 09:45 PM
Uhm, i tried that program, and now i want to delet it from my turtle, but how? I can't go back. Looks like iam stuck or something.

Can someone please help me?


And sorry for the bad english.
Parmacoy #23
Posted 10 September 2013 - 10:19 PM
Hold control + t for a few seconds, it terminates the running program, then type in the console that appears after stopping the program, rm <program name>
then also type rm lwl
your English is actually better than most native English speakers by the way… just saying
Narethian #24
Posted 11 September 2013 - 03:55 AM
:lol:/> :lol:/> Thank you, thats it.

Next time, i try "things" in singelplayer, not on a server. :D/>