Jump to content

luascript in is complete condition


highco

Recommended Posts

Hey Droidz,

I was wondering whether there is a way have Lua code in the <is complete condition> for questprofiles.

I would like to expand the garrison routine to starting workorders. and as <is complete condition> i would like to evaluate the number of available orders. this is possible with the returns from C_Garrison.GetLandingPageShipmentInfo() Lua Befehl.

I thougt it might be possible to just use the wManager.Wow.Helpers.Lua.LuaDoString(with proper lua script) in the is complete condition, but i can get it to work. Would this even work in theory. How do i have to format the Luascript for the wmanager. Can i just put my luascript in the brakets.

If this wouldnt work this way at all, is there a possibility to use the OverridePulseCSharpCode QuestType and have the <is complete condition> configured somehow in the c# code.

Thanks a lot for Your help.

Best Regards

highco

Link to comment
Share on other sites

Hello,

You can use code like this in <is complete condition>  (not tested):

        int shipmentCapacity = wManager.Wow.Helpers.Lua.LuaDoString<int>("local name, texture, shipmentCapacity, shipmentsTotal, creationTime, duration, timeLeftString, itemName, itemIcon, itemQuality, itemID = C_Garrison.GetLandingPageShipmentInfo(); return shipmentCapacity;");
        int shipmentsTotal = wManager.Wow.Helpers.Lua.LuaDoString<int>("local name, texture, shipmentCapacity, shipmentsTotal, creationTime, duration, timeLeftString, itemName, itemIcon, itemQuality, itemID = C_Garrison.GetLandingPageShipmentInfo(); return shipmentsTotal;");
        return shipmentsTotal >= shipmentCapacity;

 

A few samples of lua usages:

string luaValue = wManager.Wow.Helpers.Lua.LuaDoString("luaVarName = 'value text'", "luaVarName");
        string luaValue2 = wManager.Wow.Helpers.Lua.LuaDoString<string>("return 'value text';");
        bool luaValueBool = wManager.Wow.Helpers.Lua.LuaDoString<bool>("return 1==1;");
        wManager.Wow.Helpers.Lua.LuaDoString("print('run lua code without return value');");

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...