What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

LokiPoe.InGameState.IsChatWindowVisible exception

Tormiasz

Community Developer
Joined
Jun 16, 2014
Messages
701
Reaction score
5
Hello.
I dont know why but LokiPoe.InGameState.IsChatWindowVisible gives me exceptions very often (everytime at first call when the window is visible (after typing text)). The game is hunging for some seconds and when it get's back, character got disconnected and this exception occurs:

Buddy.Coroutines.CoroutineUnhandledException: Exception was thrown by coroutine ---> System.Exception: Ukończono tylko część żądania ReadProcessMemory lub WriteProcessMemory, at addr: 00000000, Size: 668
w GreyMagic.ExternalProcessMemory.ReadByteBuffer(IntPtr addr, Void* buffer, Int32 count)
w GreyMagic.MemoryBase.Read[T](IntPtr addr)
w Loki.Game.LokiPoe.?????????????????????????????????????????.get_Ui()
w Loki.Game.LokiPoe.InGameState.get_UiMain()
w Loki.Game.LokiPoe.InGameState.get_ChatControlPtr()
w Loki.Game.LokiPoe.InGameState.get_GlobalChatControlPtr()
w Loki.Game.LokiPoe.InGameState.get_IsChatWindowVisible()
w SmartBot.Tasks.FakeTask.<EnsureEnter>d__10.MoveNext() w c;\faked\h.cs:wiersz 130
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
w SmartBot.Tasks.FakeTask.<methdo>d__7.MoveNext() w c;\faked\h.cs:wiersz 103
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.GetResult()
w SmartBot.Tasks.FakeTask.<Logic>d__0.MoveNext() w c;\faked\h.cs:wiersz 78
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w Loki.Bot.TaskManager.4QSck\&tAF2M"B`j%E\*\&oBw5T#.MoveNext()
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
w Loki.Bot.Logic.Bots.OldGrindBot.OldGrindBot.\\4jy;qZ(GEdtWtr@xD/eSI>|$.MoveNext()
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w Buddy.Coroutines.Coroutine.M}Wy8t:Koc\&=G)C?Kl\[pB>=\.".gc6ua;2>\[<#L%{#xR\\a_6Mbc!.MoveNext()
--- Koniec śladu stosu wyjątków wewnętrznych ---
w Buddy.Coroutines.Coroutine.?????????????????????????????????????????(Boolean )
w Buddy.Coroutines.Coroutine.?????????????????????????????????????????(Boolean )
w Buddy.Coroutines.Coroutine.Resume()
w Loki.Bot.Logic.Bots.OldGrindBot.OldGrindBot.Tick()
w Loki.Bot.BotManager.?????????????????????????????????????????(IBot )


Code that is causing error
Code:
 private static async Task<bool> EnsureEnter(bool visible)
        {
            for (var i = 0; i < 10; i++)
            {
                    if (LokiPoe.InGameState.IsChatWindowVisible == visible)
                        return true;

                    LokiPoe.Input.PressKey(Keys.Enter);
                    await Coroutine.Sleep(Utility.LatencySafeValue(100));
            }

            return false;
        }

Any ideas? For sure the bot was InGame.
 
Last edited:
Hello.
I dont know why but LokiPoe.InGameState.IsChatWindowVisible gives me exceptions very often (everytime at first call when the window is visible (after typing text)). The game is hunging for some seconds and when it get's back, character got disconnected and this exception occurs:

Buddy.Coroutines.CoroutineUnhandledException: Exception was thrown by coroutine ---> System.Exception: Ukończono tylko część żądania ReadProcessMemory lub WriteProcessMemory, at addr: 00000000, Size: 668
w GreyMagic.ExternalProcessMemory.ReadByteBuffer(IntPtr addr, Void* buffer, Int32 count)
w GreyMagic.MemoryBase.Read[T](IntPtr addr)
w Loki.Game.LokiPoe.?????????????????????????????????????????.get_Ui()
w Loki.Game.LokiPoe.InGameState.get_UiMain()
w Loki.Game.LokiPoe.InGameState.get_ChatControlPtr()
w Loki.Game.LokiPoe.InGameState.get_GlobalChatControlPtr()
w Loki.Game.LokiPoe.InGameState.get_IsChatWindowVisible()
w SmartBot.Tasks.FakeTask.<EnsureEnter>d__10.MoveNext() w c;\faked\h.cs:wiersz 130
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
w SmartBot.Tasks.FakeTask.<methdo>d__7.MoveNext() w c;\faked\h.cs:wiersz 103
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.GetResult()
w SmartBot.Tasks.FakeTask.<Logic>d__0.MoveNext() w c;\faked\h.cs:wiersz 78
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w Loki.Bot.TaskManager.4QSck\&tAF2M"B`j%E\*\&oBw5T#.MoveNext()
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
w Loki.Bot.Logic.Bots.OldGrindBot.OldGrindBot.\\4jy;qZ(GEdtWtr@xD/eSI>|$.MoveNext()
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
w Buddy.Coroutines.Coroutine.M}Wy8t:Koc\&=G)C?Kl\[pB>=\.".gc6ua;2>\[<#L%{#xR\\a_6Mbc!.MoveNext()
--- Koniec śladu stosu wyjątków wewnętrznych ---
w Buddy.Coroutines.Coroutine.?????????????????????????????????????????(Boolean )
w Buddy.Coroutines.Coroutine.?????????????????????????????????????????(Boolean )
w Buddy.Coroutines.Coroutine.Resume()
w Loki.Bot.Logic.Bots.OldGrindBot.OldGrindBot.Tick()
w Loki.Bot.BotManager.?????????????????????????????????????????(IBot )


Code that is causing error
Code:
 private static async Task<bool> EnsureEnter(bool visible)
        {
            for (var i = 0; i < 10; i++)
            {
                    if (LokiPoe.InGameState.IsChatWindowVisible == visible)
                        return true;

                    LokiPoe.Input.PressKey(Keys.Enter);
                    await Coroutine.Sleep(Utility.LatencySafeValue(100));
            }

            return false;
        }

Any ideas? For sure the bot was InGame.

What are you trying to do with this task?
 
Don't you see? Trying to make sure that the chat window is opened/closed.
 
Does it really matter?

Code:
 private static async Task Method()
        {
            await EnsureEnter(true);

            var pressString = "mystring";
            foreach (var ch in pressString)
                LokiPoe.Input.PressKey((Keys)ch, ch, false);

            await EnsureEnter(false);
            await Coroutine.Sleep(Utility.LatencySafeValue(500));
        }

The bot enters the chat (EnsureEnter(true), typing the text as intended and is hunging on EnsureEnter(false). When I click the mouse to close the chat by myself, the bot is getting unfrozen and can read the value.

To answer the next question, This method is called from Logic of the Task.
 
Last edited:
Does it really matter?

Code:
 private static async Task Method()
        {
            await EnsureEnter(true);

            var pressString = "mystring";
            foreach (var ch in pressString)
                LokiPoe.Input.PressKey((Keys)ch, ch, false);

            await EnsureEnter(false);
            await Coroutine.Sleep(Utility.LatencySafeValue(500));
        }

The bot enters the chat (EnsureEnter(true), typing the text as intended and is hunging on EnsureEnter(false). When I click the mouse to close the chat by myself, the bot is getting unfrozen and can read the value.

To answer the next question, This method is called from Logic of the Task.

Ok You don't need to check for it.

Using paste, you can just paste the string in.

LokiPoe.InGameState.Paste(" ");

AFIK, that api takes care of everything.

The hung thing is, because your for loop.

You are awaiting for 100 of your latency safe value, now depending on who's latencysafe value code you are using, that's 100* latency, that could be 1000 ms or 10000 ms, depending on the latency.

For the other issue of the throw exception. Don't pass anything to the async, you shouldn't need to.
 
Try using LokiPoe.InGameState.Type instead, or Paste if you want to paste in a longer string. The API functions implement that process in a non-coroutine setup;, whereas there might be issues doing it the way you're trying from inside a coroutine.

You can use Input.PressKey(Input.Binding.chat) instead in case the key was bound differently.

If you're not using OldGrindBot, LokiPoe.Input.Binding.Update() must be called at least once in or after Start to update the input key bindings.

I just tested both functions from the DevTab locally, and it worked fine, so hopefully you see similar results.
 
Ok You don't need to check for it.

Using paste, you can just paste the string in.

LokiPoe.InGameState.Paste(" ");

AFIK, that api takes care of everything.

The hung thing is, because your for loop.

You are awaiting for 100 of your latency safe value, now depending on who's latencysafe value code you are using, that's 100* latency, that could be 1000 ms or 10000 ms, depending on the latency.

For the other issue of the throw exception. Don't pass anything to the async, you shouldn't need to.

That's not true, the bot was hunging at first iteration so loop doesn't have anything with it. But valid point at sleep, latencysafe value is not needed here.
Why don't pass anything to async?

Try using LokiPoe.InGameState.Type instead, or Paste if you want to paste in a longer string. The API functions implement that process in a non-coroutine setup;, whereas there might be issues doing it the way you're trying from inside a coroutine.

You can use Input.PressKey(Input.Binding.chat) instead in case the key was bound differently.

If you're not using OldGrindBot, LokiPoe.Input.Binding.Update() must be called at least once in or after Start to update the input key bindings.

I just tested both functions from the DevTab locally, and it worked fine, so hopefully you see similar results.

I dont know if using LokiPoe.Input.Binding.Update() or LokiPoe.InGameState.Type helped. Propably the second one because it's pressing enter by itself so LokiPoe.InGameState.IsChatWindowVisible is never true (it only hung's if IsChatWindowVisible is true).
 
Back
Top