I've been having a problem with getting return values of variables passed by DoString. My DoString works flawlessly, I'm able to call protected functions, ect, but every time I try using getLocalizedText it never returns anything.
Doing everything through my console using also works, ex: playerName = UnitName("player"); ----- print(playerName)
Example:
Code:
public string CharacterName()
{
DoString("playerName = UnitName(\"player\");");
var playername = (GetLocalizedText("playerName"));
return playername;
}
Code:
public ulong PlayerGuid()
{
DoString("guid = UnitGUID(\"player\")");
string guid = GetLocalizedText("guid");
return (Convert.ToUInt64(guid, 16));
}
Both calls return nothing.
Here is GetLocalizedText:
Code:
public string GetLocalizedText(string variable)
{
uint codeCave = _wowHook.Memory.AllocateMemory(Encoding.UTF8.GetBytes(variable).Length + 1);
_wowHook.Memory.WriteBytes(codeCave, Encoding.UTF8.GetBytes(variable));
String[] asm = new String[]
{
"call " + (Offsets.lua.ClntObjMgrGetActivePlayerObj + _wowHook.Process.BaseOffset()) ,
"mov ecx, eax",
"push -1",
"mov edx, " + codeCave + "",
"push edx",
"call " + (Offsets.lua.FrameScript__GetLocalizedText + _wowHook.Process.BaseOffset()) ,
"retn",
};
string varResult = Encoding.ASCII.GetString(_wowHook.InjectAndExecute(asm));
_wowHook.Memory.FreeMemory(codeCave);
return varResult;
}
I know there are different methods, and this one is prone to UI taint, but I'd really like to be able to get this too work.
Thanks