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

Inturtlpler - Lazy Man's Simple Command Interpreter

Started by darkrising, 13 June 2013 - 01:23 PM
darkrising #1
Posted 13 June 2013 - 03:23 PM
From the wonders of dark programs comes a new and shiney program - the inturtlpler!

This easy to use program will allow you to run turtle scripts with easy short cut syntax!

Here's an example:

for i = 1, 5 do
  turtle.back()
end

for i = 1, 5 do
  turtle.forward()
end

turtle.dig()
turtle.place()
turtle.digUp()
turtle.placeUp()
turtle.digDown()
turtle.placeDown()

Phew that's a lot of typing for such a simple program! I wish it was easier… hey wait!

loop 5 mb end
loop 5 mf end
df pf du pu dd pd

This is the same program as above but using the Inturtlpler!

But Dark… how do you do it?

Well, the Inturtlpler uses some shiny functions to convert this quick and easy shorthand to full fledged code!

Where can I download this wonderful program?

With http enabled in you config just type pastebin get N22T449A dr
Type dr and select turt.
All you have to do now is type edit and write in your instructions, save this file as anything you want, for example: house
and run the instructions you just typed by typing: turt house

Features:
  • Simple short hand commands
  • Loops
Plans:
  • More turtle api functions!!!
I've now moved the program to my github, you can now get it using the dark retriever, N22T449A

Syntax

  MF = forward
  MB = back
  MU = up
  MD = down

  TL = turn Left
  TR = turn Right

  AF = attack
  AU = attack Up
  AD = attack Down

  DF = dig
  DU = dig Up
  DD = dig Down

  PF = place
  PU = place Up
  PD = place Down

  SF = suck,
  SU = suck Up
  SD = suck Down

  FF = drop
  FU = drop Up
  FD = drop Down

  SL <slot number> = Select slot number

  LOOP <number> = start loop
  LOOP INF = infanite loop
  END = end loop
MudkipTheEpic #2
Posted 13 June 2013 - 06:17 PM
Hi! I'd like to suggest 3 features.

1: Have the program auto refuel and error when there is no fuel left.

2: Add SL to select a slot.

3: Allow loop inf for while true do.
darkrising #3
Posted 14 June 2013 - 04:15 AM
Hi! I'd like to suggest 3 features.

1: Have the program auto refuel and error when there is no fuel left.

2: Add SL to select a slot.

3: Allow loop inf for while true do.

I like those ideas, I will add them asap :)/>
superaxander #4
Posted 14 June 2013 - 04:24 AM
Nice and quick scripting thanks!
H4X0RZ #5
Posted 14 June 2013 - 12:11 PM
2 Questions:
  • 1. One:
  • How did you do the looping?
  • 2. One:
  • Is there a way for user input like:
    
    usrinp number length
    loop length MF end
    --Syntax
    --usrinp <input type> <var name>
    
darkrising #6
Posted 14 June 2013 - 03:19 PM
2 Questions:
  • 1. One:
  • How did you do the looping?
  • 2. One:
  • Is there a way for user input like:
    
    usrinp number length
    loop length MF end
    --Syntax
    --usrinp <input type> <var name>
    

The code for looping is a bit crooked, it more or less on encountering a loop looks ahead for a number and adds it to the command stack.
Not very elegant, but I am working on it :P/>
M4sh3dP0t4t03 #7
Posted 14 June 2013 - 03:38 PM
This seems like a good way to avoid a lot of typing.
murky white #8
Posted 14 June 2013 - 09:45 PM
i thought about writing a program similar to this, and lo and behold, you already did it for me! you are a scholar and a gentleman, and i thank you very much.
Niseg #9
Posted 15 June 2013 - 10:08 AM
I have a script similar to this but I never got around to "published" it
http://pastebin.com/TkNW4623

It works as far as I remember . either as a "lua" executor or a file preprocessor. if a macros file doesn't exist it will pull one from my pastebin . the macro file is in #define syntax but parameterized macros are not supported just 1 to 1 replacements.

edit: forgot to add default macro definition : http://pastebin.com/ycMm8L5N
it can be anything you want
darkrising #10
Posted 16 June 2013 - 07:12 PM
Hi! I'd like to suggest 3 features.

1: Have the program auto refuel and error when there is no fuel left.

2: Add SL to select a slot.

3: Allow loop inf for while true do.

I like those ideas, I will add them asap :)/>

Infinite loops and SL have been implemented as well as a major rewrite of the entire program (More or less)

The command structure and organisation is a lot more advanced with support for custom functions and arguments.
MudkipTheEpic #11
Posted 16 June 2013 - 08:06 PM
Don't you the need add="" outside of the for loop instead of inside?
darkrising #12
Posted 16 June 2013 - 09:03 PM
Don't you the need add="" outside of the for loop instead of inside?

No cause it needs to reset for each cycle when formatting the log.
MudkipTheEpic #13
Posted 17 June 2013 - 01:44 AM
Oh, alright.
jesusthekiller #14
Posted 19 June 2013 - 09:50 AM
Made something similar without knowing that this program even existed :P/>

I finished mine 2 days after you published yours :(/>

Anyway, have a look: here
darkrising #15
Posted 19 June 2013 - 10:48 AM
Made something similar without knowing that this program even existed :P/>

I finished mine 2 days after you published yours :(/>

Anyway, have a look: here

Yours seems quite cool, although mine won't work with normal lua :P/>

I was actually thinking of making some kind of hybrid, seems you beat me too it :D/>
Niseg #16
Posted 19 June 2013 - 11:06 AM
My program is an lua macro program which read #define from a separate file . I already figured out how to make parametrized macros work so I can probably add that functionality with some effort . I can probably also incorporate the #defines into the LUA . I've not touched this in a while because I switched to enhancing my building program (I'm late on the release ) , I also got distracted by a mining well program I wrote.

I'm still not sure if someone would really want to use a macro program . Most people just want mining scripts :(/> .
jesusthekiller #17
Posted 19 June 2013 - 11:18 AM
My program is an lua macro program which read #define from a separate file . I already figured out how to make parametrized macros work so I can probably add that functionality with some effort . I can probably also incorporate the #defines into the LUA . I've not touched this in a while because I switched to enhancing my building program (I'm late on the release ) , I also got distracted by a mining well program I wrote.

I'm still not sure if someone would really want to use a macro program . Most people just want mining scripts :(/> .

Do it just for fun/learning. I made over 15 programs and apis (I mean: fully-blown programs, 200+ lines) that no one uses :P/>




Yours seems quite cool, although mine won't work with normal lua :P/>

I was actually thinking of making some kind of hybrid, seems you beat me too it :D/>

Competing shall begin? :P/>
ElvishJerricco #18
Posted 19 June 2013 - 11:23 AM
Actually, although not nearly as powerful as this, Project NewLife has a shell script runner. You could do some pretty cool stuff with that fairly simply. Methinks my script runner needs an overhaul…
jesusthekiller #19
Posted 19 June 2013 - 12:18 PM
You have your LASM tho (which beats this and uTurtle) :)/>
darkrising #20
Posted 19 June 2013 - 01:35 PM
You have your LASM tho (which beats this and uTurtle) :)/>

Meh, I like coding things myself :P/>

But yes, I have looked at LASM, it's quite nice.