Forums » Community Projects

VO Lua Question/Answer Thread

Aug 08, 2007 MSKanaka link
This is a thread for posting questions you have about Lua and using plugins in general. Questions about individual plugins should be put in the original author's thread, however they might be answered here first.

Q: What are plugins?
A: Plugins are Lua scripts written to add to or enhance the gaming experience for a player. They may add functionality to the game that is available but not enabled (such as system chat), they may allow the player to automate the creation of alias/bind combos (such as Scuba Steve's chainfire creator, cfire), or even add tiny little features to the interface that make you wonder why they weren't there in the first place (such as spuck's in-station news ticker).

Q: Who can make plugins? What's required to do so?
A: Anyone can make an plugins for VO if they want to. All they need is access to a text editor and knowledge of Lua.

Q: I've downloaded an plugin from one of the threads on the Community Projects forum. How do I install it and use it?
A: Plugins are run from the appropriately-named folder in your Vendetta directory, 'plugins'. First, make sure you have an plugins folder in the first place. On Windows and Linux, go to the Vendetta directory, and then create a folder called 'plugins'. On a Mac, find the Vendetta application, right- or control-click on the icon, and select "Show Package Contents". Create a new folder named 'plugins' in the window that pops up. Next, unarchive the plugin you've downloaded and drag the resulting folder into the new plugins directory. Now all you have to do is start up VO. Anything in the plugins directory and its subdirectories named 'main.lua' will be run on client startup.

Q: Is there a way to reload a plugin, without exiting the client and going back in?
A: Yes. You can use either dofile(), which will re-run the script again (but may cause issues with stuff like internal dofile() calls), or you can use ReloadInterface(), which reloads every plugin you have in the plugins folder as if you had rebooted the client.
Aug 11, 2007 Scuba Steve 9.0 link
A mystery sticky, hrmm.
Aug 11, 2007 MSKanaka link
It wasn't me!

... or was it...
Aug 28, 2007 raybondo link
Lua addons are now called plugins.

As of the August 31 2007 update it will use lua 5.1.2. As a result, there will probably be some incompatibilities with plugins written before then.
Please read this section of the lua 5.1 documentation for details.
Sep 06, 2007 Syylk link
An introduction to Lua that may help wannabe coders to move their first steps:
Sep 10, 2007 JohnB link
Q: Is there a way to reload a plugin, without exiting the client and going back in?

If there is, it would be useful for people like me who're new to Lua - I'm getting a lot of errors and things that don't work as I expect at the moment, and after each one need to log out and exit the client then go back in which is a bit of a pain.

Edit: I've found one way to do it - 'dofile ("plugins/myplugin/file.lua")' from the console, but not sure if that's the best way (in particular, if file.lua itself contains dofile commands, it will give errors since it's running from the main vendetta directory rather than plugins/myplugin). Is there a better way?
Sep 21, 2007 raybondo link
You can also type '/lua ReloadInterface()' in the console and the interface and plugins will get reloaded.
Nov 17, 2007 mr_spuck link
Are CHAT_MSG_BAR_EMOTE1-3 and CHAT_MSG_BAR1-3 still used by the game?
chatreceiver only seems to receive CHAT_MSG_BAR_EMOTE and CHAT_MSG_BAR.
I only checked it with messages originating from me though, maybe that's why.
Jan 29, 2008 greshnatok link
I'm working on a trade plugin and want to save a fairly large amount of data; since io is not accessible, is there any other way of saving bulk data?

Dumping it all via gkini seems nasty and POSTing it via firsm's HTTP lib seems like a bit of overkill.

Any help or ideas would be greatly appreacited :)
Jan 29, 2008 slime73 link
Spickle it to your mission notes and dofile it later.
Jan 30, 2008 greshnatok link
That works, though there's a slight snag: How would I stop another plugin from overwriting everything in there?
Jan 30, 2008 slime73 link
I guess you have to make sure nothing overwrites it until you've completed the DB, then you can put the file in your plugin folder or whatever.
Jan 31, 2008 greshnatok link
It's dynamic data. Essentially what I'm trying to do is get the plugin to save what stations currently want and what they sell (and how much for); that part is trivial, the tricky part currently is making that data persistent.
Feb 01, 2008 Eonis Jannar link
Use a SQL database located on a web server.

That's what vokb did...
Feb 07, 2008 greshnatok link
I found a way to save to files (yay), but it looks like the "feature" that allows this is unintentional. I'd rather not spend time developing something which relies on a feature that could go away very soon. Is there any chance of getting a definite answer on whether the VO specific do function is going to stay?
Feb 09, 2008 slime73 link
It's gone with the latest update. It allowed you to do way more than just read/write to files, btw :P
Feb 09, 2008 slime73 link
Would it be possible to export the console dialog to the sandbox? I want to make it look better. :p
Mar 13, 2008 Vorgas link
Wondering where you were on this. I was about to embark on the same thing.
Apr 08, 2008 thenthdoctor link
I'm new but already making some cool stuff and I have a few questions.

1. How does targetLS make its roidlist persistent? I already know all about how to save stuff over http/json, but I don't think that's what targetLS is doing.
-- Nevermind, I found gkini()
2. How do VO's missions make the little button icon popup when it gets a notice? E.g. what are the magic IUP words for that? I bet it's a canvas?

I am still going through the docs but particular pointers on those two items would rock.
Apr 08, 2008 mr_spuck link
try ProcessEvent("MISSION_NOTIFICATION"). not sure if there's a more direct way.