Forums » Community Projects

VO Lua Question/Answer Thread

«123
Jun 17, 2009 maq link
/DisplaysHippos isn't a random joke,
it actually is /DisplayShipPos, (commands aren't case sensitive btw)
and it used to do just that, giving both position and heading (as quaternions).
But someone used that to make a bot (it was all during alpha, and before lua was integrated too)
Thus devs removed it, so, nope, it's not there nor is it coming back.
And since people were even then joking about hippos...
Jun 02, 2010 Metraxis link
I'm going to assume that if the thread is sticky, that any proscriptions against thread necromancy don't really apply. If I'm wrong, I apologize. I like the idea of a player-extensible system, but it brings some questions to mind:

Are there any kinds of plug-ins the developers specifically do not want to see appear?

If so, is there a list somewhere?

I'm making the assumption that the autonav/miner plug-in mentioned works by constructing a coordinate system based on the distances from 4 non-coplanar and presumably fixed objects to the player's current position, and infers the nose direction from position change and information about relative thrust, which seems an awful lot of math just to get 'roid bookmarks, but that this very kludgeyness and inability to apply the same inferences to the ship's current target are what make it acceptable. How far off the mark am I?
Jun 02, 2010 maq link
Nope, it works by taking screenshots of radar, then external program does some image recognition on them and sends results to the plugin.
I think.

What you said would work too (tho getting heading isn't quite possible this way), but, as of last update you can no longer control the ship from plugins.
Which i believe means autopilot plugins aren't welcome anymore.
Either way you'd need to send keypresses to vo from some other program.

It seems that you can make anything you like till someone complains, at least that's how it's been so far.
Jun 02, 2010 mr_spuck link
He probably meant this one.. which worked like that.
http://vendetta-online.com/x/msgboard/9/17343?page=2#264282

I don't think the devs ever specifically condemned bots and they are also not mentioned in the eula or rules. The disabling of ship control had more to do with getting rid of other types of plugins.

As long as your plugins don't do anything that a normal player couldn't do, annoy other player or break stuff they should be ok.
Jun 02, 2010 Metraxis link
After reading the thread referenced in the .127 update, it seems like you're right. Unfortunately, it also seems like "annoy another player" includes anything remotely combat oriented, or that in any way seems to duplicate a feature or technique from EVE.

Considering this, and the relative rewards of trading/mining vs even the most basic of Courier missions, along with the comparison to ship and addon prices, I conclude that VO has yet to make room for the technologist or the tycoon, To do so may even break the semi-infinite twitch sandbox feel of the environment as it stands, I don't know. There's nothing wrong with such a game per se, it's just turned out not to be for me.
Jun 12, 2010 BrokenPoet link
With the removal of ship control after the .127 update, would it be possible to re-institute a function that would return ship position? The function could be limited to only be called every 10 (30? 60?) seconds, or could only return values rounded to the nearest kilometer. It seems that with removal of ship control, it allows for the restoration of Ship Position while still avoiding the realm of automatic pilots.
Aug 07, 2010 Maalik link
So. Can you make a radar blip in-a-duel blue?
Sep 06, 2010 Pizzasgood link
Is there a way to check whether a person is in a duel? Not in a duel with you, but in a duel with other people?

I tried passing the character id to IsInDuel() but it didn't seem to work. (Yes I was in the same sector as the people in question, and they had the cyan duel-dots.) Of course the API on the wiki doesn't list it as taking any parameters but I thought I'd try it anyway.
Sep 06, 2010 slime73 link
IsInDuel() doesn't take any arguments and only returns whether your own character is in a duel or not. I don't know of any way to check if other people are in a duel. :(
Nov 21, 2010 drywall link
I had the plugin working, but came back to it after a couple weeks and now it won't unload cargo. I think it may have broken or changed with the update. I created a test case:

----------------------------------------
local shipid = GetActiveShipID()
print('scratch: shipid: '..shipid)
local inventory = GetShipInventory(shipid)
if inventory['cargo'] then
for _, id in pairs(inventory['cargo']) do
print('scratch: inventory id: '..id)
local name = GetInventoryItemName(id)
local num = GetInventoryItemQuantity(id)

print('scratch: unloading '..num..' crates of '..name..' '..id)
CheckStorageAndUnloadCargo({itemid = id, quantity = num})
UnloadCargo({itemid = id, quantity = num})
return
end
end
----------------------------------------

No error is thrown, but the cargo is still in my hold. You can test this yourself by purchasing something in a station and running this.

Did the API change in some way?
Nov 22, 2010 meridian link
Correct syntax is:
CheckStorageAndUnloadCargo({{itemid = id, quantity = num}})
UnloadCargo({{itemid = id, quantity = num}})

short form:
CheckStorageAndUnloadCargo{{itemid = id, quantity = num}}
UnloadCargo{{itemid = id, quantity = num}}
Nov 25, 2010 drywall link
So it is! Thank you so much, meridian.
Dec 13, 2011 Deathzor link
I'm trying use CreatePDATab1 apparently the input it takes as far as i understand the api wiki is a "userdata box" anybody know how to create a "userdata box" can't find it anywhere in the iup or the VO api documentation.

its seems to not be a vbox or a hbox or a sbox so I'm out of idea's effectively anybody has a example or can give me a clue ?
Dec 18, 2011 draugath link
Deathzor, most of the functions on the interface page, where you found that function, have a very singular purpose. That particular function doesn't have any arguments and returns a userdata element. It is mostly useless from a plugin writing standpoint.
Mar 12, 2012 [Gadget] link
I have two questions:

What's the current Lua version in VO?

Does anyone have an SDK/API file suitable for import into Lua for IDEA? (https://bitbucket.org/sylvanaar2/lua-for-idea/wiki/Home)
Sep 01, 2012 Irbis link
Hi guys,

OK, I'm trying to understand why this simple code doesn't work :

--------------------------------------------------------------------------
local function equip()

DisconnectAllAddons()

local addons = GetStationAddonList(GetStationLocation())

for i,addonItemID in ipairs(addons) do
print(GetInventoryItemName(addonItemID))
end

end

RegisterUserCommand("addon",equip);
--------------------------------------------------------------------------

DisconnectAllAddons works, the addons get disconnected from the active ship and I see them appear in the station inventory, but the GetStationAddonList command doesn't retrieve them, they don't appear in the "addons" array (you should try it in a station that doesn't already have the same addons in its inventory).

If I then run the plugin a second time, the disconnected addons appear in the addons array, but of course I don't want to run it a second time.

Any idea? thanks!
Sep 03, 2012 Pizzasgood link
Things are probably happening in parallel. You tell the game to disconnect the items, and it starts doing that, but it doesn't pause your plugin's execution while that happens, so it starts printing the list before it has finished disconnecting the items.

Maybe there is an event you can wait for to know when it is finished? If not, another solution would be to set up a loop that checks if anything is equipped, and if so delays a while and loops back, until nothing is equipped. I'm not bothering to look up how you check if stuff is equipped, you can do that part ;)

So it would be something like this:

-----------------------

local mytimer = Timer()
local function wait_for_unequip(callback)
if items_are_equipped() then
timer:setTimeout(500,function() wait_for_unequip(callback) end)
else
callback()
end
end

local function print_my_list()
local addons = GetStationAddonList(GetStationLocation())
for i,addonItemID in ipairs(addons) do
print(GetInventoryItemName(addonItemID))
end
end

local function items_are_equipped()
--figure out how to check if any items are equipped here, return true if so
end

local function equip()
DisconnectAllAddons()
wait_for_unequip(print_my_list)
end

RegisterUserCommand("addon",equip)
Sep 05, 2012 Irbis link
Thanx a lot, I'm going to use that!