Jump to content


Lion4ever's Content

There have been 23 items by Lion4ever (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#262367 TCCAIC [Project Ended]

Posted by Lion4ever on 01 December 2016 - 04:06 AM in Programs

This looks really interesting!
Can you add a pastebin link to your post, so i can download it directly to the command computer and/or the turtles please?



#240576 Command Computer's Turtle API

Posted by Lion4ever on 15 December 2015 - 04:23 PM in Command Programs

View PostBomb Bloke, on 15 December 2015 - 02:26 PM, said:

The turtle window wasn't centered because of mouse_click events; I'll stick a translator in there eventually, but for now it might be better to stick it back up in the top left.
Ok, i'll change that back then.

View PostBomb Bloke, on 15 December 2015 - 02:26 PM, said:

Can the script perhaps be rigged to create a suitable entity, like a lobotomised mini-slime or something? I'm too lazy to look up a selector to make it control anything other than myself...
@e[type=Pig,c=1]
Asking for a selcetor was my first choice because it is by far the most flexible way to select a entity and the ability to seize a creeper running by and let him do your work is quite satisfying. Only asking for the type may indeed be a bit easier for the user.

View PostWojbie, on 15 December 2015 - 02:36 PM, said:

Perhaps invisible immortal floating armor stand with turtle as head?
With or without armor? :D
I am going to add that as a default.



#240580 Command Computer's Turtle API

Posted by Lion4ever on 15 December 2015 - 05:08 PM in Command Programs

Updated.
Window is top left again
Only asking for type instead of selector now.
And default is an ArmorStand with a turtle on its head.



#240545 Command Computer's Turtle API

Posted by Lion4ever on 15 December 2015 - 05:46 AM in Command Programs

Ok, moving entities does now work, but there aren't any animations for armorstands yet.
http://pastebin.com/rYsd9J8B



#240472 Command Computer's Turtle API

Posted by Lion4ever on 14 December 2015 - 03:56 PM in Command Programs

View PostBomb Bloke, on 12 December 2015 - 01:50 AM, said:

ComputerCraft's move to 1.8 should open up some possibilities, [...] Sucking will still be an issue without a method of reading NBT data, however...
Luckily 1.8 does offer a method like that: /blockdata ~ ~ ~ {}
It returns false, a complain that nothing has changed and the nbt tag.

Since 1.8 has a /entitydata: Can you modify your api so that the turtle can be represented by any mob (with {NoAI:1b} ) and Armorstands (with {NoGravity:1b} )? Or allow me to modify your script and link it from here?
With the ArmorStand Pose tag it would even be possible to have an animated turtle/player like thing.



#239637 Ingame Step-by-Step Debugger

Posted by Lion4ever on 03 December 2015 - 09:54 PM in Programs

View PostH4X0RZ, on 03 December 2015 - 09:43 PM, said:

Something like this?
http://yueliang.luaforge.net

"28 seconds [...] for Yueliang 0.1.0. (Native C is virtually instantaneous, so a comparison is pointless, really.)"
That sure is slow :D



#239640 Ingame Step-by-Step Debugger

Posted by Lion4ever on 03 December 2015 - 10:45 PM in Programs

View PostYevano, on 03 December 2015 - 09:51 PM, said:

What about porting over luac and retrofitting it to add calls to the debugger framework? That could run much faster. I actually ported over a pure Lua luac implementation to CC not too long ago with the intent to add preemptive multithreading to Lua, but never ended up going further than porting luac.
Is your cc luac version uploaded somewhere?



#239631 Ingame Step-by-Step Debugger

Posted by Lion4ever on 03 December 2015 - 09:14 PM in Programs

View PostYevano, on 03 December 2015 - 08:27 PM, said:

This looks pretty awesome! Will definitely have to try it out when I get back to my PC. I know I've been itching for a debugger ever since I started my own large project a little while ago (which is now approaching 2K lines :/). Stack traces help, but often I find myself using the ol' "print stuff until you figure out the control flow of the program" method.
I tested it with a 1100 line program and it took like 3 seconds allready. It may be a bit slow on large files.

View PostSquidDev, on 03 December 2015 - 08:53 PM, said:

I'm impressed (also slightly miffed at myself for not finishing what I started).
Yeah, i looked at your program before i started programming this, but i think you are trying to inject code after the conversion to bytecode, but i think the upvalues might become a problem there, am i wrong?
If it is possible, there would not be any need to worry about syntax.

View PostSquidDev, on 03 December 2015 - 08:53 PM, said:

It might be worth looking into a Lua parser instead of using find and replace - it should be less flakey when doing something like print("repeat " .. x .. " times") (the repeat will be replaced with a scope push).

That is very true, using patterns sure is flakey. Atm my debugger is not able to handle quite a few unusual snytaxes which lua allowes. I will look into your parser, but replacing is for the normal stuff easier.



#239622 Ingame Step-by-Step Debugger

Posted by Lion4ever on 03 December 2015 - 07:38 PM in Programs

View PostGlass Systems, on 03 December 2015 - 07:20 PM, said:

Amazingly useful. Well done! :D
Thanks :)



#239606 Ingame Step-by-Step Debugger

Posted by Lion4ever on 03 December 2015 - 05:42 PM in Programs

View PostSquidDev, on 23 May 2015 - 05:25 PM, said:

I've always wanted to write a proper debugger for Lua but we can't without the debug library - it would be nice to have I just don't get why.
Well, good news: It is possible using code injection.

This is an advanced lua debugger without using the debug api.

Features:
  • stepping through your program while seeing the source
  • show local and globals variables
  • show which functions have been called (f4)
  • set breakpoint and run until you reach them
  • step-into own function and step-over
  • stepping backwards lightweight (undoing changed)
  • stepping backwards heavyweight (replay the program to last point)
  • stops on lines which throw errors (so you can see the locals or step back)
  • reverses some functions (like the turtle ones)
  • stop the program while it is running (f6 in source window)
  • lua prompt in the middle of the program execution (f10)
Is your turtle trying to build a house, but its allways taking the wrong turn at some point? Then this is perfect for you! You can step through your program (with f6) until it does the wrong turn and then you know excatly which line caused it! From there on you could even step backwards in your program (with f5) until the whole house is gone again to start over again! You can step into every function of your program, but be careful because you could even step into poop!
local function poop()
end

Screenshots:
Spoiler

Technical details:
Every start of a line gets a _lbpcf() call (line breakpoint call function). It prints the source and waits for user input. The local statements get replaced by _cnlv (create new local variable) so that they can be handled with the __index-metamethod of the environment. _bscf and _becf (block start/end call function) handle the scoping. For how the modified program look, see the .crash file that is created.


System requirements:
Required:
  • CraftOS 1.74 (might work for lower versions)
  • >0 tps
Recommended:
  • Advanced Computer with CraftOS 1.74
  • 20 tps
Installation:

pastebin get LdKK3BTE



#239635 Ingame Step-by-Step Debugger

Posted by Lion4ever on 03 December 2015 - 09:50 PM in Programs

View PostSquidDev, on 03 December 2015 - 09:26 PM, said:

Normal upvalues shouldn't break: but upvalues within loops would. Sometimes I wonder if it would have been easier just to write a Lua interpreter in Lua :P.

That would be so slow :D Well, it would not matter for a debugger.

To prevent the keywords in strings problem, i could simply remove all strings with something like
gsub('"(.-)"',function(t) table.insert(strings,t) end)
and put them back after the modifying. Once i can think of a way to do that with both " and '



#239677 Ingame Step-by-Step Debugger

Posted by Lion4ever on 04 December 2015 - 06:18 PM in Programs

Updated to version 1.1

Added inline lua prompt (f10)
stopping while running on advanced computers (f6)
and bug fixes



#239666 Ingame Step-by-Step Debugger

Posted by Lion4ever on 04 December 2015 - 11:29 AM in Programs

View Postoeed, on 04 December 2015 - 01:25 AM, said:

Wow. This is awesome. If I ever make an IDE with Silica I'd love to be able to do this.
I tried to add it to the LuaIDE on gravitystores github, but i could not get it to work...



#241873 Piston placement

Posted by Lion4ever on 30 December 2015 - 01:45 AM in Suggestions

placing the block against the turtle should be the first choice and only choice in my optionion, too.



#241874 secure modem type

Posted by Lion4ever on 30 December 2015 - 01:50 AM in Suggestions

because every user of computercraft wants to program an encrypted connection for every door program they write



#241855 secure modem type

Posted by Lion4ever on 29 December 2015 - 11:37 PM in Suggestions

Can we get a modem type that returns the java side computer id and not the lua one?

It would be really useful for bank servers or door locks or shops.

Aditionally this would make long range modems a bit less over powerd since the secure modem would only return the id of the last repeater. And because of that there would be more than one long range modem per world.



#239726 [1.75][SMP/SSP] rom-program functions in _ENV

Posted by Lion4ever on 05 December 2015 - 04:20 PM in Bugs

Now for 1.75



#241807 Is there a better way to get world orientation without gps?

Posted by Lion4ever on 29 December 2015 - 02:35 PM in Ask a Pro

Like this?
http://www.computerc...ch-or-a-ladder/



#261819 Pig latin translator

Posted by Lion4ever on 14 November 2016 - 12:38 AM in Programs

A useful trick in lua:
local vowels = {u=true,
local vowels = {
a=true,
e=true,
i=true,
o=true,
u=true}
if vowels[ string.lower( result[1] ) ] then
--this is a vowel
end

If you use the vowel as a key, you dont need a for loop.



#241871 Ranged Turtles (again)

Posted by Lion4ever on 30 December 2015 - 01:39 AM in Suggestions

View PostWait_, on 27 October 2015 - 06:35 AM, said:

another idea, what about an admin bow? rapid fire :D
There you go: http://pastebin.com/zeYgY0NF

Run "pastebin run zeYgY0NF" on a command computer -> admin bow



#241810 Minesweeper with Pistons

Posted by Lion4ever on 29 December 2015 - 03:09 PM in Command Programs

View PostBomb Bloke, on 11 December 2015 - 01:57 AM, said:

It would be nice if the script could be run without parameters. Trying it seems to reliably cause it build over the command computer midway, interrupting itself.

If there's anything above the play area (eg raised indicator blocks from the last play), building a minefield in that spot may bug out.
Fixed that. It is now one block above the computer.


View PostBomb Bloke, on 11 December 2015 - 01:57 AM, said:

I'm also having a little trouble figuring out how the indicator blocks work. When you stomp a pad which has no mines around it, the surrounding area gets triggered, which is good; but the amount of indicators that show up around the border is wrong, meaning you have to manually stomp all the pads around the perimeter anyway in order to get them to appear correctly.
Yeah, the wiring is a big difficult, if there is only a 3*2*3 area to work with. Because of that only the indicator blocks on the side of the next spots are activates (only redstone dust and no redstone repeaters are used)

View PostBomb Bloke, on 11 December 2015 - 01:57 AM, said:

I can't help but think that the way to go would be to wire up the whole grid with bundled cables. This'd theoretically allow you to connect a 256x256 play area to one side of the command computer, which could then remain running - allowing it to eg detect when the game is won. This'd also allow you to setblock some different colours for your indicators, making the board easier to "read".
There could be command blocks under the pressure plates which triggers the spot action like displaying a number with /title, /tellraw or /setblock sign.

But that would not be survival like and would not be able to explode at all.
The disadvantage with cables is that there can be computercraft without the cables and that the computer must not restart for the game to work...



#239785 Random 3D Maze Builder

Posted by Lion4ever on 06 December 2015 - 11:07 PM in Turtle Programs

Can you replace
function forward()
turtle.forward()
with
function forward()
repeat until turtle.forward()
and same with up and down? that would make the program a lot more robust if something stands in its way.
the line
turtle.select(3)
is no longer nessary because of the selectBlock method and only causes the turtle slots index to flicker after every move.

I love running through your mazes and i have created quite a few of them in my world :)



#240002 Minesweeper with Pistons

Posted by Lion4ever on 10 December 2015 - 01:48 AM in Command Programs

This is a very simple program which generates a minesweeper game in your wolrd. Each spot is 3*3 and 4 blocks high and can be activated with the stone plate on top. The number on blocks pushed up by the pistons indicate the number of surrounding mines.

pastebin get rg3Bx79Z minesweeper
minesweeper [cells in x-dir] [cells in z-dir] [mines] [min x corner of board] [min y] [min z]