Jump to content

RoboMat

Member
  • Posts

    3439
  • Joined

Everything posted by RoboMat

  1. Not sure if it works with the current version, but my mod basically does all of the above plus a few things more: http://theindiestone.com/forums/index.php/topic/1047-
  2. You should be able to do it. I think I wrote shaders for sepia, black & white and inverted colors ... EnigmaGrey might still have the shader code.
  3. It's doable - I added some scanline and colour changes a while ago:
  4. Ah sorry. Just got up Check the javadocs. The IsoCharacter should have a getter for the tile it is standing on. Probably something like getTile() or getSquare() and from there you can access the tile object and get its name / type.
  5. https://github.com/rm-code/Better-Shouts/blob/develop/RMBetterShouts/media/lua/client/bettershouts/Shouting.lua#L15 Get the player object and then simply call getX, getY and getZ on it
  6. University started and I am pretty occupied atm., but when I have a moment I'll update it. If someone else wants to update it in the meantime, just send a pull request on github and I'll gladly merge it.
  7. Check out my Convenient Bags mod: http://theindiestone.com/forums/index.php/topic/1047-convenient-bags-182/ I added a tag system to circumvent the limitations of the default ItemTypes. You could keep a list below the hood, which your mod checks against when moving items. That's how you could have different ItemTypes at least "below the hood" so to speak.
  8. You gotta start somewhere - If you look at my tutorial you can see that back in the day I didn't know about those little tweaks either
  9. Personally I prefer to make all functions local by default. So instead of GlobalTable.doMenu you can simply call doMenu. It's generally a good idea to avoid globals whenever you can. I think the require call has been fixed in one of the recent versions so you could in theory code completely without globals. As an aside: Declaring functions using the syntactic sugar (e.g. local function foo() print('Hello World') end) has some benefits. For example if you want to call it recursively you won't have to pre-declare it. Here is my old tutorial on the topic: http://pz-mods.net/guide/how-to-create-inventory-context-menus/
  10. Because the mod is outdated.
  11. I heard this thread needs to be necroed. Here is a gif showing my broken A-Star algorithm in action:
  12. No, you'd need to set an attraction point for that
  13. The easiest solution would be to use player:Say('Text I want to say') ... that would display the text above the player's head like shouting. Of course you could use the drawString() function with the event I used for the coordinate viewer (can't remember what it's called) and simply remove / hide the string after a while.
  14. Ahh that's your problem probably... You are trying to call a drawing function outside of the main "drawing" loop of the game and therefore it is ignored.
  15. table.insert and table.remove both have optional index paramters which allow you to specify at which position to insert / remove a value. Without them, the functions will always operate on the end of the table. table.insert({ 'b', 'c' }, 1, 'a') table.insert would insert 'a' at the first position in the table and automatically shifts all the other values down accordingly. table.remove({ 'a', 'b', 'c' }, 1) table.remove would remove the first entry and shift the others down in this example. The important thing to keep in mind is that this only works on sequences: A small sidenote. If you have a sequence and want to add / remove entries at the end, I prefer this: t[#t + 1] = 'bar' -- Insert new entry at the endt[#t] = nil -- Remove last entry in the tableThat's because I usually iterate over sequences using the '#' operator: local foo = { 'a', 'b', 'c' } for i = 1, #foo do print(foo[i])endThis should be faster than using table.remove / table.insert and ipairs / pairs, but for me it's just personal preference.
  16. It has it advantages. Did you hook the whole function to the correct event? (Take a look at my coordinate viewer mod)
  17. Is textToDisplay a string?
  18. It didn't do that before? Or was that broken also? Ah ... I remember that bug was introduced a while ago I think? Have you tried if it returns the loaded module correctly yet, Brybry?
  19. Well I guess you could say globals are easier to use. Generally people will tell you to avoid them and it is considered to be bad practice by many to use globals at all (although you shouldn't listen to that ... as always write something that works first and then worry about improving it). Personally I follow this, when I work on my own games - I like to keep things as separated as possible. Not sure if I understand the case you mention above, because you couldn't solve it easily with globals either. Basically wether you use the module thing I wrote above or use a global variable doesn't change much in terms of how you have to write your code. -- GlobalModule = {};function Module.sayHello() print('Hello World');endThe difference is that you have more control over the scopes in your program. For example: if true then local foo = 'visible'; print(foo);endprint(foo);The first print statement can "see" the foo variable as it is in the scope of the if block. The second print statement can't "see" it because the variable is discarded when the if statement ends. What does this mean in terms of modding? You can give your different modules, functions, and variables a much more confined and controlled space in which they live. So basically modules only need to know about the stuff that really concerns them. This also has some benefits for speed because usually accessing a local function / variable is faster than accessing the global scope. PZ is pretty extreme in that regard as all of their lua modules live in the global scope. I have no idea though if it would bring any (noticeable) performance improvements if they'd refactor their code to use locals.
  20. Usually you can use it to load modules in Lua, but in earlier version of PZ it always returned nil. Quick and dirty example: local Module = {};function Module.sayHello() print('Hello World');endreturn Module;and then in a different file you do this: local Module = require("Module");Module.sayHello(); -- Greet the world.Check out my OOP tutorial in the Tutorials section to see a bit more elaborate use case.
  21. Do you get errors in the console?
×
×
  • Create New...