Elmegaard 0 Posted June 12, 2019 Share Posted June 12, 2019 I have a Macro: /run if EnableAoe == "1" or EnableAoe == nil then EnableAoe = "0"; print("Disabled AoE") else EnableAoe = "1" print("Enabled AoE") end And a LUA script condition: print(EnableAoe) When I run this it works fine, but as soon as the "EnableAoe" variable is set, the fight class stop working until I reload the ui. The variable is printed just fine though and it doesn't matter if it is a print or not, as soon as I have any reference to that variable that is hit, this happens. Meaning, if I put it in an "if 1 == 2", the issue is not there. Even if I put the spell with the condition as the lowest priority so it is never hit it is a problem. Even if I set the variable to null again, it is a problem. The only thing that fixes it is a reload of the UI. The error I get in game is this: A macro script has been blocked from an action only available to the Blizzard UI. I have tried both with and without addons. I have tried looking in the taint.log file, and it is spammed hard by wrobot, so it is a bit hard for me to figure what is wrong. EDIT: It seems like the problem only occurs after the first time the variable has been accessed. If I put the spell with the Lua Script to the bottom, it works until that spell has been called. If I remove the spell or the condition, the problem persists until the ui has been reloaded. Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/ Share on other sites More sharing options...
Matenia 628 Posted June 12, 2019 Share Posted June 12, 2019 You're trying to call secure (more or less) code from insecure code (wRobot unlocks Lua). The environments clash. No, there is no fix for this except using C# and disabling Lua protection for the call you use to extract the EnableAoe variable from the client's memory. However, this instantly puts you at risk of being banned. Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54481 Share on other sites More sharing options...
Elmegaard 0 Posted June 12, 2019 Author Share Posted June 12, 2019 I see. Thank you. Is there any way to pass data to wrobot from in game? I just want to toggle a couple of variables using macros instead of having to stop the bot, switch a variable and start it again. It would also be fine if I could draw a gui using wrobot or something similar to switch a variable directly there. Also, has this behavior changed? I remember this working a couple of years ago. There are also references to this exact thing around the forums. Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54483 Share on other sites More sharing options...
Matenia 628 Posted June 12, 2019 Share Posted June 12, 2019 There are a couple threads on the forums on how to use keybinds in your fightclass. Yes it worked when warden was garbage and wRobot could just run whatever code unprotected. Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54485 Share on other sites More sharing options...
Elmegaard 0 Posted June 12, 2019 Author Share Posted June 12, 2019 I see what you mean, but it is the other way around I need. I need to pass information from wow to wrobot. Do you mean I can change my keybinding ingame and read that in wrobot or what do you mean? It is just a boolean value I need, so whatever workaround I can use would be fine. Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54486 Share on other sites More sharing options...
Matenia 628 Posted June 12, 2019 Share Posted June 12, 2019 (edited) I mean instead of hitting an ingame macro to change a Lua variable, just make your fightclass listen to keys (examples on the forums, by reapler I believe). Or you could just use the Lua.LuaDoString calls that don't use an unlocked Lua unevironment. If you're on vanilla/tbc you'll be fine. Any other expansion you're taking risks. Although as long as you only read from Lua and don't execute any functions, you should be fine. Edited June 12, 2019 by Matenia Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54488 Share on other sites More sharing options...
Elmegaard 0 Posted June 12, 2019 Author Share Posted June 12, 2019 I tried using Lua.LuaDoString, and I get the same problem it seems. Lua.LuaDoString<bool>(@" if (EnableAoe == ""0"") then return false else return true end") Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54489 Share on other sites More sharing options...
Matenia 628 Posted June 12, 2019 Share Posted June 12, 2019 Check the PartyHelper project, it uses LuaDoString with a parameter that enables you to call insecure code. Or do: Lua.SecureLuaCall = false; Lua.LuaDoString(""); Lua.SecureLuaCall = true; Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54490 Share on other sites More sharing options...
Marsbar 228 Posted June 12, 2019 Share Posted June 12, 2019 Would the robotmanager.helpful.var stuff work for this?https://marsbars.gitlab.io/unoffical-wrobot-api-docs/api/robotManager.Helpful.Var.html#robotManager_Helpful_Var_GetVar__1_System_String_ Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54492 Share on other sites More sharing options...
Elmegaard 0 Posted June 12, 2019 Author Share Posted June 12, 2019 I will try these things, thanks guys! Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54493 Share on other sites More sharing options...
Elmegaard 0 Posted June 12, 2019 Author Share Posted June 12, 2019 The robotmanager.helpful.var, does not seem to return anything, not sure what variable it is trying to find, the documentation isn't that helpful. Also, I am doing this using the FightClass creator and I don't think I can have multiline c# in it's conditions unfortunately. I may have to convert everything to c# because of this.. Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54494 Share on other sites More sharing options...
Elmegaard 0 Posted June 13, 2019 Author Share Posted June 13, 2019 I finally made it work. For anyone interested here is my solution. I converted the spell to a c# script and made the following: // Rain of Fire Lua.SecureLuaCall = false; string canCast = Lua.LuaDoString<string>("return EnableAoe"); Lua.SecureLuaCall = true; if (canCast != "0") { var rof = new wManager.Wow.Class.Spell("Rain of Fire"); rof.Launch(); } Link to comment https://wrobot.eu/forums/topic/11384-using-variable-from-macro-in-lua-script-is-producing-an-error/#findComment-54514 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