Jump to content

w00zla

Members
  • Posts

    79
  • Joined

  • Last visited

Posts posted by w00zla

  1. Found a bug, when I've enabled the UI, then put in a trading system module. I can't open the trading system module UI. Disabling the UI also removes the trading system UI button. It can be fixed by disabling the UI, removing the trade-module, re-adding the trade module, and then re-enabling the UI (moving the button back to the far left of the list).

     

    Hope that helps you squash the bug.

    -KineticNerd

     

    thanks for your feedback, but unfortunatelly, i cannot reproduce your issue! since i got some questions:

    what Avorion version are you using (mine is beta 0.11. r7857 atm)?

    have you other mods installed?

    can you reproduce the problem and send me maybe correspondig client-log file (its located in %APPDATA%\Roaming\Avorion\)?

    and maybe its also relevant which rarity the trading upgrade is (mine was exotic)?

  2. When I'm trying to do something like this in script that I attached earlier:

    -- MyScript
    function initialize()
        local entity = Entity()
        if someCondition then
            entity:removeScript(pathToMyScript)
        end
    end
    

    server just crashes with error "EXCEPTION_ACCESS_VIOLATION".

     

    So.. how to removeScript from itself?

     

    just use terminate() instead ... it sets the script to invalid and removes it automagically on the next ocassion!

  3. Update: Tested some more mods.

    Moved some more mods around.

     

    What do you think of the doesn't work catagory?

    Should I keep it or just not include mods that don't work?

     

    I think it might be not a good idea, since there are two versions of the game (stable, beta) and maybe there are just some (config) quirks so different mods donkt work for one but the others!

    but i like the other categories :)

  4. Thanks, I'm going to the finish.. gradually.

     

    I'm trying to add some custom variables that're accessible after restart to the all Stations and Ships made by players in the sector. So I think I should  do all checkings and attach script in the Sector's "onEntityCreate" callback or in defaultscripts.lua.

    But then I need to access this local script variables in some vanilla scripts, that were attached to this ship/station too.

     

    I don't think that variables from one attached script are visible to another attached script. Because it shouldn't be. So I think to complete my first mod for this game I just need to understand how people use variables from attached scripts anywhere.

    Maybe its something related to 'require', but I don't need to require a whole script again.

     

    I'll try to search in existing mods again.

     

    you cannot exchange properties/variables of attached scripts, but can use Entity():invokeFunction() to call functions in other attached scripts and get its return values, so you could create a function to invoke which returns your required values from the script!

  5. Thanks. I understand how to use 'secure' and 'restore', but I can't understand where to put them.

     

    I mean, for example we have a defined class "Person" with some methods and callbacks like "onFirstStep". And if we want to "say hi", when user makes his first step:

    1. We will make a new class that extends "Person" and overrides "onFirstStep".

    2. Or we'll just change "Person" definition.

     

    I'm not very familiar with the Lua, but in our case we don't have definitions for classes and structures, for "Entity".

    So, what should I do, just put 'restore' and 'secure' in a random place in a random file and wait it to 'fire'? I don't think  that's a good idea.

    Also I don't want to extend and override Entity structure. That's a bad idea too.

    -

    You gave me link, but showdist mod has nothing to do with 'secure'.

     

    sry, was the wrong link: https://github.com/w00zla/avorion-showdist/blob/master/scripts/player/cmd/showdistjump.lua

     

    and for the rest aka LUA coding techniques:

    LUA has no (built-in) concept of OOP and therefore overriding of classes/functions is not possible (there arent even classes in the OOP sense!).

    Avorion/LUA works by attaching scripts to different game world objects (=entities), which makes those scripts run in the context of the entity (i.e. player scripts are active while player is online, ship scripts are active while ship-entity is not destroyed etc.).

    You MUST define the secure() and restore() functions (and lots of others depending on their actual intention) in a script attached to an entity for them to work properly (look here how scripts are attached).

  6. There are several options:

     

    you can either save values for a specific script instance via this functions (looky here http://avorion.gamepedia.com/Entity_scripts):

    - secure()

    - restore()

     

    HowTo: in secure() just return some variables and define exactly those for your return() function as parameters (have a look at the code of the showdist mod for an example)

     

    or you could set and get values via the "property bag" of Server(), Sector(), Player(), Entity():

    - setValue(key, value)

    - getValue(key)

     

     

  7. So einfach ist das leider nicht, man braucht leider mehr als nur eine Mod:

     

    [*]Mod welche den Status der Player und des Servers eine eine Datei ausgibt (solange bis RPC Unterstützung für das Game kommt)

    [*]Programm welches aus dem Status eine Bilddatei generiert

    [*]Die Bilddatei muss dann regelmäßig auf einen Webserver oder Image-Hoster kopiert werden damit man das Bild in Foren etc. einbinden kann

     

    Ich hoffe das sowas wie GameTracker sowas bald für Avorion anbietet!

  8. thats a pretty interesting and fun idea! i think i will have a look at it...

    currently following comes to my mind when thinking about the features:

     

    - UI for creating and seeing your and all other bounties, and cancelling yours

    - some sort of escrow system with handling of bounties even when player should be offline

    - lots of notifications, maybe a permanent HUD display when a bounty is on you

    - bounties on ships would be possible

     

    one thing to clear in before would be how to handle which player gets the bounty if multiple players attack one target...

     

     

    other ideas would be:

    - special target marker on HUD or notifcations if any player with bounty is in your sector?

    - overview of sectors in the UI where players with bounty are in

    - special sectors where players with bounty are invulnerable?

     

  9. bump for the sake of all that is holy... I hear by declare that if you have mods to post that you add them to the thread as well as in their own. Or someone.... Maybe I will... I havent figured this out yet... will make a new thread with a current mod list... We should have a community list. Its a thing.  8) 8) 8) 8)

     

    +1

  10. good news everyone :D

     

    updated the OP and released version 0.6-alpha of the mod!

     

    Changes:

    • introduced search modes and related config (by default, the mod now searches only in sectors discovered by the player :D see "HOW TO - Search modes" section in op)
    • mod now tries to auto-detect its configuration for a galaxy (this may fail so you would have to configure manually with /findstationconfig)
    • mod now hosted on GitHub, so unregistered users can download it too, and because of source control, and because why not ;)

     

     

    Please give feedback if auto-detect of config does not work for you (on windows, PowerShell and WMI need to be available)!

  11. Exactly. I don't want to spend a bunch of time writing something that is literally already being officially developed, but on the other hand Mojang promised a modding API for Minecraft and 5 years later we have "resource packs". :o

     

    Yeah, thats also true, and in Mojangs case really not the "interface" you wished for as a modder...

    hmm, i really get itchy developer fingers when reading and thinking about a fully-fledged standalone mod-loader for Avorion, but I really would be interested in when koonschi plans to release the Steam Workshop support (a platform Mojang never had for MC modding)!

    since he also plans to finish the game completely by end of the year (means out of early access), I doubt any bigger mods integration project will pay off ....

     

    whats your opinion guys??

  12. I'd think of that as more a launcher, but maybe that's just semantics. Regardless, what you've described is well beyond the scope of what I'm doing at the moment, but I like the ideas.

     

    If no one works on something like that, I might look at it in the future. I'd probably want to put all of the core functionality in a c static lib and  make it compatible with zip and patch files.

     

    With a proper launcher, a lot of the stuff I'm doing at the moment could be simplified to just a set of utility functions.

     

    Having that functionality built in to the game engine would be best though as that would make it possible to have per-save mod configurations and client downloading from server.

     

    I think that may all come with Steam Workshop support for the game?! Here is the question when the support will be released and if its worth the time developing such an fully-fledged loader??!!

  13. Would this work installed only on my client?  The server owner is anti-modding.

     

    since the galaxy/sector files are saved on the server, the server-side scripts need all to be installed, sry about that!

     

     

    ...added super fast sector checking routine, now searches finish in few seconds and only have little performance cost...

     

    Could you elaborate on "only have little performance cost"? Will this mod definitely have at least a minor impact on performance? Is it easily noticeable? Or only barely noticeable?

     

    Also: Would the performance hit be even more noticeable on a server that regularly has 10 to 24 players at any given time?

     

    This was at least considered on the multiplayer server where I play. However, even after upgrading the server, there are lag issues. And the concern is that - because this is server-side - this mod might make existing lag/performance issues worse. (The thinking is that there is not enough "headroom", performance wise, for something like this.)

     

    well, the mod/scripts takes performance only while searching, and the impact is not noticeable on my machine anymore due to the new checking routine. BUT if you've got a busy server thats already running out of spare performance, I would not recommend installing this mod without adjusting the performance settings (see "HOW TO: Performance tweaking" and "HOW TO: Advanced server configuration" sections in OP!). If you set concurrent searches and loaded sectors per frame to 1, I think this runs smoothly even on busy servers without affecting performance noticeably. But you would have to try, as there is defenitely some performance cost due to the scripts reading lots of sector files each search!

     

     

    Hmmm... I have aproblem:

    When i open chat and give the command "/findstationconfig galaxy Utopia" i become the errormessage: Unknown command findstationui.

     

    Utopia is the name of my galaxy. Or must i type the command in a other console than chat?

     

    Hmm, thats really strange, especially because the error seems to reference the "findstationui" command, while you were using the "findstationconfig" one?! Could you please send me your client- and server logs? They are stored in folder "%APPDATA%\Roaming\Avorion".

  14. Over the weekend I've been tinkering with a function that will make it easy for modders to add custom system upgrades to NPC ships as loot with a single function call

    .....

    This will make it a lot easier to get a custom system upgrade module into the game without hacking base files.

     

    It's not quite ready to release but getting close.

     

    That sounds really good :) I will give the loader a try and test as soon as this is implemented completely, as this is what I need for my next mod idea!

  15. you can also use the /run command to add and remove player/entity scripts while ingame!

    everytime you add a script, it will be reloaded from disk and executed, so you can even edit the files while the game is running =)

     

    /run Player():addScript("player/myscript.lua")
    /run Player():removeScript("player/myscript.lua")
    
    /run Entity():addScript("entity/myscript.lua")
    /run Entity():removeScript("entity/myscript.lua")
    

     

  16. From my side, no need to credit for the function, just happy another modder finds it useful ;D

     

    Your progress and changes sound good so far, and I would really like to take a grasp on it!

    did you forget to attach/link your new version or didnt you release it yet?

  17. Any way to make it only show stations that a given player has discovered?  Right now it seems like it reveals areas a player has never been to (but obviously another player has)

     

    this is under investigation at the moment 8) the info about discovered, and not created sectors, is stored in the player.dat files, which are binary and their structure is pretty unknown (I didnt find any usable info at least). If I can reverse engineer the file structure and parse its data in an reasonable amount of time/performance, this feature may become available with the next update.

     

    But i cannot promise and maybe this will only be available with the release of proper API access to sector/galaxymap data!

  18. Edit 1: Sector():spawn Station/Ship/ASteroids etc. expects an EntityDescriptor.

    Sector():createEntity() expects an EntityDescriptor. You can build very customized Entities that way.

    It can have Components  [enum ComponentType] (which you can't get from an spawned Entity!) Also some other properties which later become read only/ not readable at all might be set there.

     

    Edit2: my move Asteroid mod uses this to create Asteroids.

     

    ty much, now I understand :) I think its viable to say its kind of a template for entities then...

  19. I've only been scripting LUA for a week or so. I glanced briefly at LUA file system options and they seem clunky, at best.

     

    Of course I'd prefer to have mods loaded without any file editing... but as a compromise, I'd rather edit 1 line per mod in a single file than randomly hacking through or overwriting base game files, which is the current standard.

     

    Ideally, load mods from zip files in data/mods/ directory.

     

    I'm using onPlayerLogIn event from server.lua to attach a script specified by mod info file to the player and/or run an onInitialize function in the mod info file. That allows a lot of functionality because the events system is quite powerful. I don't think a mod loader needs to do "all the things", it just needs to load the mod and let the mod author have access to the events system.

     

    If zip files aren't possible then iterate through a directory for files like the mod info above and load it in.

     

    Trade goods and production recipes are a challenge. I'm not sure if there's a way to make changes to the goods table and production table. The problem is that there is no global instance.

     

    Dont take my comment negatively, i like your general approach and think your code is already a really good starting point :)

     

    I dont have much LUA experience for myself (has been several years since last LUA script before Avorion) and was also struggling with the filesystem/io capabilities of LUA! But luckily LoSboccacc came up with a good solution for scanning directories for files, and i made working function out of it for my findstation mod (works on win and linux):

     

    require("stringutility")
    
    function scandir(directory, pattern)
    
        local i, t, popen = 0, {}, io.popen
    local BinaryFormat = string.sub(package.cpath,-3)
    local cmd = ""
    if not string.ends(directory, "/") then
    	directory = directory .. "/"				
    end
    local path = directory	
    if pattern then 	
    	path = path .. pattern
    end
        if BinaryFormat == "dll" then
    	path = string.gsub(path, "/", "\\")
    	cmd =   'dir "'..path..'" /b /a-d'
        else
    	path = string.gsub(path, "\\", "/")
    	cmd = "ls " .. path
        end
        local pfile = popen(cmd)
        for filename in pfile:lines() do
    	i = i + 1
    	if string.starts(filename, directory) then
    		t[i] = string.sub(filename, string.len(directory) + 1)
    	else
    		t[i] = filename
    	end		
        end
        pfile:close()
        return t
    
    end
    

     

    this code gives you a table of all found files, with optional search pattern. use it like scandir("<Avorion>/data/mods/", "*.lua") to get all scripts in a dir 8)

     

    for the possibilities of a script loader in general (this is just to my knowledge at the moment, please post if you have more info):

    the only real hook to get custom scripts working without modifying any vanilla files is to create commands = create script files in the /data/scripts/coommands directory ... but we cant influence that in any way and command scripts will always have to go there and be on-demand by the user, so nothing of interest for the loader.

    I also see only a few possibilities of hooks into scripting by modifying few basic vanilla scripts like "server.lua":

    - events/callbacks of Server()

    - events/callbacks of Sector()

    - events/callbacks of Player()

    then, of course, the direct attachment of scripts to the Player() entity.

    If something like a basic entity-script loader is integrated, we could also have the "Entity():addScriptOnce()" mechanism provided directly to mods by the loader, and then have also:

    - events/callbacks of Entity()

     

    All other modifications of stuff, like i.e. trade goods and production recipes, spawns, loot, like you said, require the direct modification of the vanilla scripts, and this is not manageable by a loader without overwriting each "addScript()" line in every vanilla script :o

    but the loader could of course modify "vanilla scripts of high interest and use" and provide some kind of replacement mechanism and/or simple API for i.e. adding new upgrades or goods, until workshop support comes its way ;)

     

  20. btw i found out u can find the entities functions here

    /Avorion/Documentation/Entity.html

    Player functions and variables are available in Documentation/Player[Client].html and Documentation/Player[server].html. Yet you found some Functions I didn't know existed. I'm interested in such functions for the Entity-object :)

     

    also interesting is that the EntityDescriptor (/Avorion/Documentation/EntityDescriptor.html) is documented with seperate functions, dont really know why ... whats the actual difference between Entity and EntityDescriptor then? Anybody knows?

  21. i have the same opinion like rater193.

    a general modloader would be great, but your approach requires too much tinkering by the end-user.

    an approach with scanning special mod folders for scripts and including them automagically would be much more handy and less error-prone in my opinion! what do you guys think?

×
×
  • Create New...