Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

mpmxyz

Members
  • Content Count

    56
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by mpmxyz

  1. Update 12.08.15: Crunch has been rewritten to be modular. This made adding new features easier. Some of them are: -compressing multiple occurrences of "t.veryLongIndex" with "t[x]" (x being a variable with the value of "veryLongIndex") -unification of string and number values using the shortest representation with the same value ("\"test\"" vs. [["test"]] vs. '"test"') -The program can be interrupted by pressing Ctrl + C. (It might be delayed when tree processing is enabled.) Does anyone have suggestions for further improvements? I'll see if I can implement them nicely using the modul
  2. This software is meant to run in the background and has no graphical interface. So there wouldn't be much I could show. (apart from the debug mode output, which is included in my post) Any ideas? PS: I wrote a detailed introduction on how to set up a turbine and included ready to use examples for reactors and turbines to make up for the missing GUI.
  3. If you like to use the program edit, you can install my device file system: devfs (extract it with "tar -xf devfs.tar" within the root directory) It isn't finished yet - please report any bugs - but you can access the bios via /dev/eeprom/bios. (It also includes a lot of other drivers.)
  4. Did I understand you correctly, that you'd like to copy a component's address? For blocks it is quite easy: Shift+Ctrl+Right click with an Analyzer on the block. But I have no idea if it could be easily done with cards and upgrades.
  5. Sorry for double posting but I've got another... Update 24.06.15: added --verbose option prints what crunch is doingadded --debug option to show stack traces of parsing error messages That means that they aren't included by default anymore. (which increases readability)improved error messages now with file and line numberimproved execution speed by writing a more efficient recursion flattening code That's the thing I mentioned in my previous message. Krutoy's Data Center is still limited by memory because it consists of around 18*8570=154260 tokens That makes around 27 bytes of T3 s
  6. Looks like my lazy programming started to haunt you: --TODO: change pasting system to be top-bottom? (pasting takes n² time at worst case when moving stuff only one level at a time) Just to explain that: In order to represent lists of values there have to be rules like: table = {<content>} content = <empty> OR <value> , <content> The parser therefore creates the following structure for "{1,2,3,}": <table> { <content> 1 , <content> 2 , <content> 3 , <content> <empty> } This unnecessary nes
  7. The camera is only able to sense a distance. You can translate that into a color for drawing if you want but it won't have any relation to the color of the block the camera might have seen. Press Shift while having the mouse over the item to see a description. For API documentation you should try "=tostring(components.network.send)" in the lua command line. You have an optional parameter there which you don't have with a normal network card.
  8. Yeah, the traceback has been in there since I had to fix some nasty bugs. Update (10.06.15): made traceback on error optional via --debug option I also took the time to add a small header to all my source files. I'm also researching more into Deflate since I introduced LZ77 compression to crunch. It actually is the first step of Deflate. The huffman encoding would be the second one. (I'd also like to include some more efficient algorithms for compression. -> It'll take some time.)
  9. #1: You can put --options wherever you want. (i.e. --output behind the input file) "shell.parse" doesn't care! But the whole "user interface" part was just quickly added to the program. I should revisit that part soon... #2: That's probably because the original file doesn't have that many local variables defined at the first line of the file. They are added during compression to avoid repetition of long strings, numbers and global variables. ->The compressed file has a slightly different structure. #3 + #4: It's actually the same bug and it's not even mine: https://github.com/Mighty
  10. Update 06.06.15: --lz77 option is now available! This option enables compression using a LZ77 variant. -> You can now achieve space savings of around 50%! @natedogith1 @dgelessus @Krutoy242: Thanks for your help! Your discussion gave me a lot of motivation to look into the topic of compression and your research into permitted characters in long strings helped me a lot since I could simply start writing code instead of beginning with my own tests. Just for your entertainment, some bugs I ran into during development: -reference length wasn't limited during compression: Above t
  11. #1+#2: I'm using io.lines with an extra parameter to read the file in short 512 byte pieces. The feature with the extra parameters doesn't exist in Lua 5.1. It instead just reads the file line by line but does not return newline characters. That makes crunch think the file is just one line. Now to #1: The file starts with a single line comment and crunch thinks there is only one line... (->It's removed.) And #2: The words are separated by newline characters only. Imagine what happens, when you ignore them! :-P Even though I'm not completely supporting 5.1, I'll see if I can add a
  12. Introduction cbrowse is a program you can use to inspect and modify the lua environment and components - the latter one being the reason I developed such a complex program in the first place. You can find a detailed description in the man page. To get a quick overview I recommend the following picture series: Viewing and Editing Default Screens Other Features Man Page Depencencies Software All required libraries are included in the download. Hardware GPU + screen: min. 20x7 monochrome, 80x25
  13. Why aren't you using Microcontrollers? https://github.com/MightyPirates/OpenComputers/issues/788 They can send messages to a specific side. To receive messages from one side only you can combine multiple microcontrollers. (and tell only one of them to forward messages)
  14. Without seeing the updated code it's hard to guess. But probably it's just because - according to the documentation - it is should be spelled "Idle". (with a big "I") One hint for future debugging: Using the function "print" to display important values while running your program helps a lot. When you do that you have to think about what output you expect and have to compare that to what you got: dofile("config") print("energy", s.energyAvailable()) --debug output for energy available print("state", s.stargateState(), (s.stargateState() == "idle")) --you can also output some of your condit
  15. Introduction This program and its library make setting up PID controllers in Minecraft easy. Controllers are used whenever you want to maintain a certain speed, temperature etc. An example system in Minecraft would be a Big Reactors turbine: It takes an adjustable steam flow rate and has a speed that should be maintained at an optimal value of 1800 rpm. A turbine controller would therefore have the following inputs: 1. the current turbine speed 2. the target turbine speed (1800 rpm) and the following output: 1. steam flow rate (a value that would let the tu
  16. Very nice idea. I haven't tested it yet but there is the line local probe = not #targets which is probably not working as expected: probe is always false because #targets always returns a number. Support for OpenComputers networks would be very nice indeed. Maybe there are already some file hosting protocols/programs for OpenComputers out there. (e.g. available via https://github.com/OpenPrograms)
  17. Fun fact: "The other mod" also uses an event loop. But it is waiting for a special timer event instead of actively checking the time. (Yes, you can also read all CC lua source files if you open it's Jar file. But searching OCs files in github is far easier. )
  18. A lot of functions actually come from OpenOS, which is not installable on micro controllers and drones. (no floppy or HDD) os.sleep as an example can be found in /boot/02_io.lua, line 66. (You could use that as a base for your own implementation for drones.)
  19. Nice. I see a swarm bombing program coming up soon... (sounds like a good opportunity to try out networking)
  20. I played around with drones today and just for fun I wanted to create some kind of bombing drone. To do that it would need to carry some payload to specified coordinates and "deliver" it there. The problem is the last part: Drones can't place blocks in midair and you can't give them an Angel Upgrade. Was that on purpose to make robots more powerful or is it an oversight?
  21. Introduction imagine you are programming a drone or a microcontroller... And then you are hitting the EEPROM limits - 4KiB isn't a lot of space. Now you could start writing ugly code but there is a better solution: Crunch! Crunch is a program that compresses Lua source files. Depending on the input file size and the amount of memory available it is able to utilize a variety of methods to keep the output size small. That is starting with simple token based whitespace reduction and reaching to full parsing and scoping rules to replace local variables with shorter names
  22. Your problem is that the function checkPlayerPos always returns in the first if statement. --check the given condition if (dir == "up") and (player.y == 1) then --if it is true: execute this part return false else --if it isn't: execute this part return true end --The code below is never executed because both parts return. You'd have to modify your if statements so that they don't always return but instead continue with the next if statement. If you don't want to think about it; read this spoiler:
  23. 1) Default Lua libraries are already loaded in _G. To load other libraries you have to use 'require'. You can read in the Lua 5.2 documentation how 'require' works in detail. Here is the short version: 1st: It checks the contents of 'package.loaded' to find out if the library has already been loaded. 2nd: If not, it checks the contents of 'package.preload'. Any function found is executed and it's return values are returned. 3rd: If steps 1+2 failed it uses 'package.path' to find and execute a file To find all loaded and preloaded libraries you just have to iterate the tables and remem
  24. What I see is that you create one of two buttons at the beginning of the program depending on the value of isRefueling. But it isn't updated when isRefueling is changed. (Another error, Lua is case sensitive: IsTownActive and isTownActive are two different variables.) But all in all that are just 'normal' bugs. So, which problems do you exactly have? (Expected vs. observed behaviour, error messages etc.) If that is specified more clearly it is easier to help you.
  25. mpmxyz

    Lua minifier

    I'm using a LR(1) parser and I haven't separated building its parsing table and the actual parsing yet. (But that's easy since this table stays the same.) I implemented it that way because serializing this table was less of a priority while testing. (It only takes 3 seconds to build with a lot of profiling included; fast enough for testing without the need to have a separate 'build step'.) The parsing table itself consists of around 200 tables with 50k entries. (I'm considering adding code to make it a LALR parser which should cut down on the number of states.) That's why. (In short: It's stil
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.