Lua ToString And Getlocalized text menu

User Tag List

Results 1 to 4 of 4
  1. #1
    haku43's Avatar Member
    Reputation
    3
    Join Date
    Sep 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua ToString And Getlocalized text

    Hi, i need some help with returning values from DoString, which works fine.

    Code:
     public void DoString(string lua)
                {
                    Synchronize();
                    uint codeCave = _magic.AllocateMemory(0x2048);
    
                   _magic.WriteBytes(codeCave + 0x1024, Encoding.UTF8  .GetBytes(lua));
                    // _magic.WriteASCIIString(codeCave + 0x1024, lua);
    
                    _magic.Asm.Clear();
                    AsmUpdateCurrentManager();
    
                    //_magic.Asm.AddLine("push {0}", State);
                    _magic.Asm.AddLine("push {0}", 0);
                    _magic.Asm.AddLine("mov eax, {0}", codeCave + 0x1024);
                    _magic.Asm.AddLine("push eax");
                    _magic.Asm.AddLine("push eax");
                    _magic.Asm.AddLine("call {0}", (uint)Offsets.Lua.Lua_DoString);
                    _magic.Asm.AddLine("add esp, 0xC");
                    _magic.Asm.AddLine("retn");
    
                    _magic.Asm.InjectAndExecute(codeCave);
                    _magic.FreeMemory(codeCave);
                    ResumeMainThread();
                }

    This doesn't return anything, but doesn't crash.

    Lua.DoString("result1251 = " & cmdstr)
    result = Lua.GetLocalizedText("result1251")

    Code:
    public byte [] GetLocalizedText(string lua)
                {
                    Synchronize();
                    uint codeCave = _magic.AllocateMemory(0x256 );
    
                   // _magic.WriteBytes(codeCave + 0x256, Encoding.UTF8.GetBytes(lua));
    
                    _magic.Asm.Clear();
                     AsmUpdateCurrentManager();
    
                    _magic.Asm.AddLine("mov ecx, {0}", BlackRain.Common.Objects.ObjectManager.Me.BaseAddress);// BlackRain.Common.Objects.ObjectManager.Me.BaseAddress);
                    _magic.Asm.AddLine("push {0}", -1);
                    _magic.Asm.AddLine("push {0}", codeCave + 0x128);
                    _magic.Asm.AddLine("call {0}", (uint)Offsets.Lua.Lua_GetLocalizedText);
                    _magic.Asm.AddLine("retn");
    
    
    
                         uint result = _magic.Asm.InjectAndExecute(codeCave);
    
                    byte[] sResult = new byte [128]; 
                    if (result != 0)
                    {
                        sResult = _magic.ReadBytes(result, 128);
                    }
    
                    ResumeMainThread();
                    return sResult;
    
                }
    This one crashes.

    Code:
     public string ToString(int argument, int length)
                {
                 
                    uint codeCave = _magic.AllocateMemory(0x1024);
                    AsmUpdateCurrentManager();
                    _magic.Asm.Clear();
                    _magic.Asm.AddLine("push {0}",0);
                    _magic.Asm.AddLine("push {0}", argument);
                    _magic.Asm.AddLine("push {0}", State );
                    _magic.Asm.AddLine("call {0}", (uint)Offsets.Lua .LuaToString);
                    _magic.Asm.AddLine("add esp, 0xC");
                    _magic.Asm.AddLine("retn");
    
                    uint result = _magic.Asm.InjectAndExecute(codeCave);
                    System.Console.WriteLine("ToString: {0:X}", result);
    
                    _magic.FreeMemory(codeCave);
                 
                    try
                    {
                        return _magic.ReadASCIIString(result, length);
                    }
                    catch (Exception e)
                    {
                        return "";
                    }
                }
    
               public override string ToString()
                {
                    return ToString(GetArgument(), 100);
                }
    
      private int GetArgument()
                {
                    if (LastArg < GetTop())
                    {
                        LastArg++;
                    }
                    return LastArg;
                }
    
    
    
     public int GetTop()
                {
                    uint codeCave = _magic.AllocateMemory(0x1048);
                    _magic.Asm.Clear();
                    _magic.Asm.AddLine("push {0}", State);
                    _magic.Asm.AddLine("call {0}", (uint)Offsets.Lua.LuaGetTop);
                    _magic.Asm.AddLine("add esp, 0x4");
                    _magic.Asm.AddLine("retn");
    
                    uint result = _magic.Asm.InjectAndExecute(codeCave);
                    _magic.FreeMemory(codeCave);
                    return (int)result;
                }
    
         public uint GetState()
                {
                    uint codeCave = _magic.AllocateMemory(0x1048);
    
                    _magic.Asm.Clear();
                    _magic.Asm.AddLine("call {0}", (uint)Offsets.Lua.LuaGetState);
                    _magic.Asm.AddLine("retn");
    
                    uint result = _magic.Asm.InjectAndExecute(codeCave);
                    _magic.FreeMemory(codeCave);
                    return result;
                }
               private void ResumeMainThread()
                {
    
                    SThread.ResumeThread(MainThread);
              
                }
    
                private void Synchronize()
                {
                    SThread.SuspendThread(MainThread);             
                }
    I want to write a simple bot, which will iteract with world using WoW API.
    Is it rationally to use this aproach without callbacks to get the return values?
    Last edited by haku43; 09-07-2010 at 09:20 AM.

    Lua ToString And Getlocalized text
  2. #2
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    I dont think you will get a reply, this is a repost. A lot of people ask this question and it has been answered. Most likely and infraction will be the result of this.

  3. #3
    haku43's Avatar Member
    Reputation
    3
    Join Date
    Sep 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well i am actualy not asking "How to",there is something wrong with the code, i need help to make it work.
    Last edited by haku43; 09-07-2010 at 12:34 PM.

  4. #4
    Chinchy's Avatar Active Member
    Reputation
    21
    Join Date
    Mar 2009
    Posts
    71
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at GetLocalizedText in IDA. You'll see your mistake. One of them at least.

Similar Threads

  1. LUA's, and ToStrings, and Bears? Oh My!
    By Harland in forum WoW Memory Editing
    Replies: 13
    Last Post: 02-18-2010, 08:31 PM
  2. LUA Portal and Patch 2.4.3
    By edcbabe in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 07-29-2008, 09:33 PM
  3. [Release?] Blocking ColorMe and other text coloring addons
    By TheSpidey in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 07-23-2008, 07:51 AM
  4. Replies: 1
    Last Post: 03-23-2008, 11:34 PM
  5. [Ascent MOD] Reload LUA scripts and Script_bin!
    By Le Froid in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 01-03-2008, 10:29 PM
All times are GMT -5. The time now is 06:08 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search