RoboMat Posted November 18, 2013 Author Share Posted November 18, 2013 The download button on pz-mods doesn't work? Will check it when I get back home! It shouldn't require you to log in usually... Link to comment Share on other sites More sharing options...
d00de Posted November 18, 2013 Share Posted November 18, 2013 Hello you brilliant people! Am I missing something, the download button doesn't seem to work?Same here. I registered about a week ago but you don't need to log in to download, it's the button that is broken. Link to comment Share on other sites More sharing options...
RoboMat Posted November 19, 2013 Author Share Posted November 19, 2013 Talked to Aricane and the issue should be solved now Link to comment Share on other sites More sharing options...
Notas Posted November 20, 2013 Share Posted November 20, 2013 I am at current Steam beta (it says 17(0014) in the bottom right of the game). When I activate your RMUtility in the mod manager, close the game and start it again, it crashes right at the start and throws me back to steam. No error message, nothing. I see the black screen of the beginning, but no warning about early access etc, it closes and that's it. Link to comment Share on other sites More sharing options...
RoboMat Posted November 20, 2013 Author Share Posted November 20, 2013 It is a bug with the current modloader and the devs should have fixed it in the next version You can try to go to C:/Users/YOURUSERNAME/Zomboid/mods folder and delete loaded.txt. Then try again to activate it. Link to comment Share on other sites More sharing options...
Ramibuk Posted November 24, 2013 Share Posted November 24, 2013 Here are some ideas of functions which can be added: Replace or move item;-- (_item1,_item2,_container) --replace item1 and move item2 to new container-- (_item1,item2,nil) --replace item1 with item2-- (_item1,nil,_container) --move item1 to new containerfunction morphItem(_item1,_item2,_container) local resultItem=_item2 or _item1; local container1 = _item1:getContainer(); local container2 = _container or container1; container1:Remove(_item1); if container2:getType() == "floor" then container2:getSourceGrid():AddWorldInventoryItem(resultItem, 0.0, 0.0, 0.0); else container2:AddItem(resultItem); endendRandomize order in table: --return table with values in random orderfunction shuffleTab(_table) local T = _table; for i=#T, 2, -1 do local j = ZombRand(i)+1; T[j],T[i] = T[i],T[j]; end return TendMake simple sound:--_sound if its nill it make only silent noise to attract zombies--_loop play sound in cycle--_square--_radius--_volume what zombies hear--_soundVolume - what player hearfunction MakeNoise(_sound,_loop,_square,_radius,_volume,_soundVolume) if _sound then getSoundManager():PlayWorldSound(_sound,_loop,_square, 1,_radius,_soundVolume,false); end addSound(_square:getFloor(),_square:getX(), _square:getY(),_square:getZ(),_radius,_volume);end;I will have couple more next week,I just need to finish something first and then shape them a little bit. Link to comment Share on other sites More sharing options...
ExcentriCreation Posted November 25, 2013 Share Posted November 25, 2013 "You know my brother once told me.... That nothing someone says before the word 'BUT', really counts" I don't mean to sound negative or anything BUT: having external resources like this for modders kinda makes things more complicated for the people using the mods..... "Must first download RoboMat's modding utilities" While having resources like this for modders to see, learn from..... In my words, Reverse Engineer (I know I learned a lot from RoboMats tutorials)..... Is a good thing. I kind of question what business a person who NEEDS these sort of resources, active while their "mod" is running, has in programing to begin with. I wouldn't have said anything BUT..... Adding to it? Whats next? A completely separate game running RoboMats lua library? Link to comment Share on other sites More sharing options...
RoboMat Posted November 25, 2013 Author Share Posted November 25, 2013 having external resources like this for modders kinda makes things more complicated for the people using the mods..... "Must first download RoboMat's modding utilities"Well I see where you are coming from, but if installing a second mod (or reading the instructions) is too much for some people then I don't think they should be playing my mods I kind of question what business a person who NEEDS these sort of resources, active while their "mod" is running, has in programing to begin with.Maybe a person - like me - who didn't take any programming lessons. Or a person - again like me - who doesn't want to code the same functions over and over again for every mod they make. Or maybe it is just a question of "Dry" vs. "Wet" code ... I honestly don't know (I actually really think that I don't have any real business in programing ) Adding to it? Whats next? A completely separate game running RoboMats lua library?That's my master plan... *manic laughter* Link to comment Share on other sites More sharing options...
ExcentriCreation Posted November 25, 2013 Share Posted November 25, 2013 That's my master plan... *manic laughter* lol..... Untrained/Bedroom programmers have their place (everything I know is from pulling apart existing code & asking questions).... don't take this as more aggressive than it is, I just think that if someone is interested in this sort of thing, using detailed sub-libraries is kinda counter productive Link to comment Share on other sites More sharing options...
RoboMat Posted November 25, 2013 Author Share Posted November 25, 2013 Untrained/Bedroom programmers have their place.... don't take this as more aggressive than it is Doesn't sound aggressive to me ... just cocky as hell tbh o.O I just think that if someone is interested in this sort of thing, using detailed sub-libraries is kinda counter productive I'm not forcing anyone to use these utilities, nor did I ever say that these are proper libs. I only released them to help the modding community and to get "newbies" started - that's something I rarely see from "trained classroom(?) programmers" ... Ramibuk 1 Link to comment Share on other sites More sharing options...
ExcentriCreation Posted November 25, 2013 Share Posted November 25, 2013 Doesn't sound aggressive to me ... just cocky as hell tbh o.O I'm not forcing anyone to use these utilities, nor did I ever say that these are proper libs. I only released them to help the modding community and to get "newbies" started - that's something I rarely see from "trained classroom(?) programmers" ... What can I say.... I have a gift for creative skills.... & I am Cocky as Hell What I meant by learning from pulling apart existing code & asking questions, is that I have no "official" training either... what I know is from GOING OUT OF MY WAY to pull apart code & ask questions.... If I had "official" training I wouldn't have spent so long in damn useless BASIC.... Seriously, earlier this year I spent a month figuring out the logic behind pathfinding & coding my own system into a DarkBASIC program only to have the FPS die after loading 500 pollies.... That's not something a "Trained" programmer does, but at least, now, I understand how pathfinding works. If I had pulled the pathfinding function from an external resource, then It would have been nothing but a wasted month Agree to disagree then, Im just expressing an opinion on how I learned..... Am Learning Link to comment Share on other sites More sharing options...
RoboMat Posted November 25, 2013 Author Share Posted November 25, 2013 Agree to disagree then, Im just expressing an opinion on how I learned..... Am Learning Sure you did Here are some ideas of functions which can be added: I will have couple more next week,I just need to finish something first and then shape them a little bit. Thanks Ramibuk. I will add them in the next update Link to comment Share on other sites More sharing options...
Ramibuk Posted November 25, 2013 Share Posted November 25, 2013 i just noticed that in first function dont work spawning of item when container is floorEDIT and now i see playing sound stops when player move.So i need to rework them both:(.At least shuffle is working Link to comment Share on other sites More sharing options...
RoboMat Posted February 2, 2014 Author Share Posted February 2, 2014 Updated to Version 2.0:Version 2.0.0- Completely rewritten code => Divided the former utils in seperate sub libraries -> LibMath -> LibString -> LibTable -> LibZomboid => Usage-Instructions can be found here: New documentation of each function.- Added IO classes => FileIO -> Can read any file -> Basic tag reading functionality => IniIO (WIP) -> Can read .ini files -> Can write .ini files- Rewritten LuaBenchmarker- RMUtility.getVersion() can be used to see if the user has installed the correct version of the Utils.Just a fair warning: As I restructured everything and fubared some stuff it might have some bugs Link to comment Share on other sites More sharing options...
ExcentriCreation Posted February 3, 2014 Share Posted February 3, 2014 - Added IO classes => FileIO -> Can read any file "Can read any file"? Are you just referring to the file extension? Because I haven't noticed any change to the getFileReader method.... Still seems to be pointed at the lua cache directory Link to comment Share on other sites More sharing options...
RoboMat Posted February 3, 2014 Author Share Posted February 3, 2014 Last time I talked to RJ he said, that they won't open the FileReader to us, so we are limited to Zomboid/Lua for the moment. Yes I was talking about file extensions. Link to comment Share on other sites More sharing options...
Dr_Cox1911 Posted May 15, 2015 Share Posted May 15, 2015 I know, this thread is old but I´m kinda stuck right now.Looks like I´m to dumb to use the ini-reader, so how the heck do I use it? EDIT: My code:Cox = {};Cox.readIni = function()local IniIO = IniIO;IniIO:readIni("CoxConfig.ini", true);endEvents.OnServerStarted.Add(Cox.readIni);I´m getting the standard error for me: java.lang.RuntimeException: attempted index: readIni of non-table: null Link to comment Share on other sites More sharing options...
turbotutone Posted May 16, 2015 Share Posted May 16, 2015 i think it might be the sugar syntax there, try:IniIO.readIni("CoxConfig.ini", true); Link to comment Share on other sites More sharing options...
RoboMat Posted May 16, 2015 Author Share Posted May 16, 2015 The version of turbo should work ... I totally forgot I released the IniIO thing (IIRC I never really finished it) Link to comment Share on other sites More sharing options...
Dr_Cox1911 Posted May 17, 2015 Share Posted May 17, 2015 Hm, even with the "." instead of the ":" it throws the same error. I implemented my own little code now based on RoboMats and RJs.Just to get this straight, what exactly is the difference between "." and ":" anyway? Thanks for the help so far! Link to comment Share on other sites More sharing options...
RoboMat Posted May 17, 2015 Author Share Posted May 17, 2015 The : passes the table in which the function is located as the first parameter. Inside of the function you can then use the "self" key word to access it. function foo:bar() print(foo == self) -- Should print true.end Then again I just came back from a seminar and got hit in the head pretty often, so not sure if I forgot something Dr_Cox1911 1 Link to comment Share on other sites More sharing options...
valrix Posted June 2, 2015 Share Posted June 2, 2015 Since I needed to work with config files and your IniIO was mostly done, I helped finish it up! IniIO.lua-- =============================================================================-- INI Reader / Writer-- by RoboMat---- Created: 30.01.14 - 16:59-- modified by Valrix 01.06.15 - 23:38-- =============================================================================-- -------------------------------------------------- Global Variables-- ------------------------------------------------IniIO = {};-- -------------------------------------------------- Global Functions-- ------------------------------------------------function string.startsWith(String,Start) return string.sub(String,1,string.len(Start))==Startendfunction string.contains(String,Search) return string.find(String,Search,1,true) > 1endfunction string.trim(String) return String:match'^%s*(.*%S)' or ''end-- -------------------------------------------------- INI READER-- ----------------------------------------------------- Reads a file written in .ini-format:-- http://en.wikipedia.org/wiki/INI_file---- @param String _path-- @param Boolean _createIfNil--function IniIO.readIni(_path, _createIfNil) local path = _path; local useNewFile = _createIfNil or false; -- Create new file reader. local reader = getFileReader(path, useNewFile); if reader then local file = {}; local section; local line; while true do line = reader:readLine(); -- If no line can't be read we know that EOF is reached. if not line then reader:close(); break; end -- Trim whitespace and remove uppercase letters. line:trim(); if line:startsWith("[") then --[[ We have a new section ]] -- -- Cut out the actual section name (remove []). section = line:sub(2, line:len() - 1) -- Create a new nested table for that section. file[section] = {}; elseif line:contains("=") then --[[ We have a key && value line ]] -- -- Make sure we have an active section to write to. assert(file[section], "ERROR: No global properties allowed. There has to be a section declaration first."); -- Split the key from the value. local key,value = string.gmatch(line, "(%w+)=(%S*)")(); key = key:trim(); value = value:trim(); -- Use the key to index the active table and store the value. file[section][key] = value; end end return file; else print("\nERROR: Can't read file at: " .. path .. "\n"); return; endend-- -------------------------------------------------- INI WRITER-- ----------------------------------------------------- @param String _path-- @param Table _ini-- @param Boolean _createIfNil-- @param Boolean _append--function IniIO.writeIni(_path, _ini, _createIfNil, _append) local path = _path; local ini = _ini; local useNewFile = _createIfNil or true; local append = _append or false; local writer = getFileWriter(path, useNewFile, append); if writer then for section, values in pairs(ini) do writer:write("[" .. tostring(section) .. "]\n"); for key, value in pairs(values) do writer:write(tostring(key) .. "=" .. tostring(value) .. "\n"); end end writer:close(); else print("\nERROR: Can't create file at: " .. path .. "\n"); return; endend Usage Example:ZConomy = {};ZConomy.config = {};function ZC_config() if not fileExists(getMyDocumentFolder().."/Lua/ZConomy.ini") then local config = { ["Pop"] = 1.5, ["Snack"] = 1.25, ["Petrol"] = 0 }; ZConomy.config["Prices"] = config; IniIO.writeIni("ZConomy.ini", ZConomy.config); else ZConomy.config = IniIO.readIni("ZConomy.ini"); endendEvents.OnGameBoot.Add(ZC_config);Example Output (from above code):[Prices]Pop=1.5Snack=1.25Petrol=0 RoboMat 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now