rater193 Posted March 13, 2017 Share Posted March 13, 2017 Oh wow, i realized that it all was already pretty well doccumented, however i will still post the exposed functions here, including the hidden ones! :P Hello, i looked at the documentation, its great and everything, but doesnt show ALL the functions that players can use, for example, using the players inventory, or even a list of player functions(unless i looked over it lol) I have however been able to expose the functions manually, but i still dont know what the arguments for the functions might be. Regardless, i will post what i found here, in case anyone else wants to know :P If anyone else needs me to expose some functions for a userdata object, let me know, and i will add it here. Exposed functions Player: Description: To get a player, just type Player(playerid) and that will return the userdata object. Example usage: local targetPlayer = Player(5) local inventory = targetPlayer:getInventory() btw i just read over what i typed, and didnt realize i typed targetPlayer:targetPlayer() fail >_< i feel stupid now :P anyways i updated the code sniplet to what it should have been targetPlayer:getInventory() Functions: canPayMoney __call setResources payMoney getTraits receiveResource resolveScriptPath createStationStyle payMoney getShipType hasStaticRelationsToFaction removeScript getStationStyleNames getShipCargo addMail getShipCrew hasScript addColor addScriptOnce addScriptOnce__index createShipStyle getShipNames canPayMoneyreceive getShipStyle knowsFaction unregisterCallback getMail getValues setValue getColor getShipPosition payResource __avoriontype readMail getLanguage removeMail sendChatMessage getInventory getShipPayment updateMail getValuesgetScripts getShipPaymentTime ownsShip registerCallback getShipPlan clearMail getHomeSectorCoordinates receiveMoney __newindex getTrail setTrait getResources __gc canPayResource invokeFunction setStationRelationsToFaction getShipStyleNames getRelations setHomeSectorCoordinates getStationStyle Player's inventory Description: get the players inventory by calling player:getInventory() Functions: amount take __avoriontype setAmount addclear removeAll remove find __index getItemsByType __gcsetEmpty addAt __newindex Comment here for any userdata objects yo want exposed Link to comment Share on other sites More sharing options...
Laserzwei Posted March 13, 2017 Share Posted March 13, 2017 Great List thank you. The Entity Object would be nice Link to comment Share on other sites More sharing options...
rater193 Posted March 13, 2017 Author Share Posted March 13, 2017 Great List thank you. The Entity Object would be nice ill add all the exposed functions, and their arguments to the post, btw i found out u can find the entities functions here /Avorion/Documentation/Entity.html Link to comment Share on other sites More sharing options...
w00zla Posted March 13, 2017 Share Posted March 13, 2017 here another tip to add (its not that obvious): if you call invokeServerFunction() or invokeClientFunction() you get an implicit global var called callingPlayer which holds the index of the player entity which called that function! I also think it would be a good idea to collect all the "special" entity script functions called by the engine if they are declared (this Wiki page lists most of them I think, but that page is hard to find in the wiki...): Link to comment Share on other sites More sharing options...
Laserzwei Posted March 13, 2017 Share Posted March 13, 2017 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 :) if you call invokeServerFunction() or invokeClientFunction() you get an implicit global var called callingPlayer which holds the index of the player entity which called that function! Damn I always wanted to know where to get the "callingPlayer" Variable. This could be helpful. Link to comment Share on other sites More sharing options...
w00zla Posted March 13, 2017 Share Posted March 13, 2017 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? Link to comment Share on other sites More sharing options...
Laserzwei Posted March 13, 2017 Share Posted March 13, 2017 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. Link to comment Share on other sites More sharing options...
w00zla Posted March 13, 2017 Share Posted March 13, 2017 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... Link to comment Share on other sites More sharing options...
rater193 Posted March 14, 2017 Author Share Posted March 14, 2017 I am in the middle of writing a custom server management command pack for backing up and restoring sectors/players, as well as a few other things, once i finish it, i will start exposing functions again. Link to comment Share on other sites More sharing options...
Laserzwei Posted March 14, 2017 Share Posted March 14, 2017 not sure if it's still up to date: www.avorion.net/forum/index.php/topic,1416.msg14444.html Link to comment Share on other sites More sharing options...
rater193 Posted March 14, 2017 Author Share Posted March 14, 2017 not sure if it's still up to date: www.avorion.net/forum/index.php/topic,1416.msg14444.html oh wow, this saved me a TON of work xD thx :P Link to comment Share on other sites More sharing options...
rater193 Posted March 14, 2017 Author Share Posted March 14, 2017 not sure if it's still up to date: www.avorion.net/forum/index.php/topic,1416.msg14444.html i was wanting something handled by lua though, i noticed that was handled by csharp, at work atm, so cant reply immediately Link to comment Share on other sites More sharing options...
rater193 Posted March 14, 2017 Author Share Posted March 14, 2017 not sure if it's still up to date: www.avorion.net/forum/index.php/topic,1416.msg14444.html Is there a version for linux? Link to comment Share on other sites More sharing options...
Laserzwei Posted March 14, 2017 Share Posted March 14, 2017 oh wow, this saved me a TON of work xD thx :P It fulfilled it's need then ;) 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