Jump to content

Weird stuff with Send("8")


 Share

Recommended Posts

I've been making an autoloot for this game, where the pcikup skill was in slot number 8,

that would mean making a simple script pressing 8 would pickup all the stuff on the floor automatically...

Now i'm trying to make the script to STOP when i get out of the window (with alt+Tab) and resume after i get back in...

WinWaitActive("Deicide online")
WinActive("Deicide online")
$Start = WinWaitActive("Deicide online")
$Stop  = WinWaitNotActive("Deicide online")

If $Start = 1 then
    While 1                 
        Send("8")       
        Sleep(200)          
    Wend                    
    EndIf

If $Start = 0 Then
    While 1
        sleep(1000)
    WEnd
EndIf

If $Stop = 0 then
    While 1                 
        Send("8")       
        Sleep(200)          
    Wend                    
    EndIf

If $Stop = 1 Then
    While 1
        sleep(1000)
    WEnd
EndIf

Now, it continues outside of the window of the game, and secondly and most importantly IT SOMEHOW IS PRESSING CAPS LOCK ?!

i've been using capslock as a "Push to Talk" button in TeamSpeak and somehow it's spamming the capslock button, an if i'm not mistaken also some other buttons like Alt, but that's only when they're pressed down, i think...

weird stuff :whistle::)

so, any feedback?

EDIT: when i just use this it also spams the capslock:

winwaitactive("Deicide online")

While 1
Send("8")
Sleep(200)
Wend
Edited by omglol
Link to comment
Share on other sites

The loops you setup have no way of exiting if you do anything.

If $Start = 1 then
    While 1                    
        Send("8")        
        Sleep(200)            
    Wend                    
    EndIf

Once you are in this loop, there is no way out. When you change windows, the loop is still running

Link to comment
Share on other sites

Try this:

HotKeySet("{Esc}", "captureEsc")
WinWaitActive("Deicide online")
WinActive("Deicide online")
$Start = WinWaitActive("Deicide online")
$Stop  = WinWaitNotActive("Deicide online")

while 1
    Select
        case $Start = 1
        While 1                    
            Send("8")        
            Sleep(200) 
            if $Stop = 1 then exitloop      
        Wend                    
    EndSelect
WEnd

func captureEsc()
    Exit
EndFunc

Link to comment
Share on other sites

Thanks for the help

I will first thing in the morning, 3:11 AM here, good night.

i personally think that this would work then, will try soon:

i'm really tired, but this way when i get out of the game window it should leave the loop, right?

but then it has nothing to do, shouldn't it have like:

HotKeySet("{Esc}", "captureEsc")
WinWaitActive("Deicide online")
WinActive("Deicide online")
$Start = WinWaitActive("Deicide online")

; IMPORTANT: Put your "Pickup" skill in Slot 8
;         of the quickbar, and l00t!

while 1
    Select
        case $Start = 1
        While 1                
            Send("8")      
            Sleep(200)
            if $Start = 0 then exitloop   
        Wend                   
    EndSelect
WEnd

while 1
    Select
        case $Start = 0
        While 1                      
            Sleep(1000)
            if $Start = 1 then exitloop   
        Wend                   
    EndSelect
WEnd

func captureEsc()
    Exit
EndFunc

OR i could be way off, i'm still new to scripting, be gentle ^^

cya tomorrow, and thanks again.

Edited by omglol
Link to comment
Share on other sites

$WindowName = "Deicide online"

While WinExists($WindowName) ;Only run if the window exists!
    
    While WinActive($WindowName) ;When the window is active, run this loop
        Send(8)
        Sleep(200)
    WEnd
    
    Sleep(100) ;When window is not active.. there is a small sleep to reduce cpu load

WEnd

MsgBox(4096+16, "Error", $WindowName & " window was not found!") ;Window was not found.. Error message before script exits

Link to comment
Share on other sites

Knight yours works like a charm, for some reason volleyman's didn't, but i really appreciate the help.

The weird thing still is when i get in the game and it starts pressing 8 like perfectly, it also still let's the capslock button flicker, as if it's pressing that aswell, why?

Btw i changed Send(8) to Send("8") in your script.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...