Sign in to follow this  
Followers 0
Pera

NEed Help with My Script

4 posts in this topic

Hey everyone,

I just need a quick help with a script I wrote. Its not doing what I thought it would. What I want this script to do is mainly search a chat log for a specific word and take action when the word is found. I hope it makes sense. Thanks in advance for any help.

[/autoit]
$file = FileOpen("Chat.log", 0)

While 1

  MouseMove(600, 330)
  Mouseclick("Right", 600, 330, 1)

  
  $LinestobeRead = FileReadLine($file)
  $TexttobeRead = StringMid($LinestobeRead, 1)

  Select
 
    Case $TexttobeRead = "entering"

         Sleep(Random(60000, 85000)
         Send("{LCTRL, 2"}
     Send("{g}")
         DeleteLog()
     InsideBG()

    Case $TexttobeRead = "wins"

     Sleep(Random(130000, 150000)
    
    CaseElse

     Sleep(Random(20000, 30000)

  EndSelect
Wend

Func DeleteLog()

    FileClose($file)
    FileDelete("chat.log")
    $file = FileOpen("chat.log", 2)
    FileClose($file)
    $file = FileOpen("chat.log", 0)
    EndFunc  

Func InsideBG()

    $counter = 0

    while $counter = 0

        For $i = 5 to 1 Step -1

            Send("{TAB}")
            Sleep(random(2000, 4000)
        Next
    
        Send("{LCTRL, 2"}
        Send("{g}")

        $counter = StringInStr("$TexttobeRead", "wins")
    Wend

    EndFunc
[autoit]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Send("{g}")oÝ÷ Ù8^­æ¬¢|¨º¯zÚ.±ç.®­§$zÛ¢¹ÊÉbá'µêߢ·±jjez+,jeÉ·jëÊ¡j÷­¢×¥+m«b·ljÊ^r&¥r«iË^­©ÝZÂÝ!ü¨¹ØmºÇº¹rn¶ëlÜ(ºWcºËhºÚn¶Ø^Âݪê-z{^®«¨µ*"²ØZµªk¡¹^^*.Á©í¶Ö¤{)Úç[ÊåÊÞr«iË^®z®mꮢ׬jëh×6$counter = StringInStr("$TexttobeRead", "wins")

The first parameter as it is now don't do much because it's actually just a string and will be used by

the script exactly as you can see it in the code. Remove the quote and the variable will then be used.

Fix those and see if it works. If not, explain what doesn't work.

Edited by Helge

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

It doesn't read the chat.log. Instead it skips all the way to the bottom and back to the mouseclicks. So having trouble with actually making this work;

$LinestobeRead = FileReadLine($file)

$TexttobeRead = StringMid($LinestobeRead, 1)

Select

Case $TexttobeRead = "entering"

I want to be able to get the text from chat.log as a string and assign it to $TexttobeRead, than search for the string "entering" within that string.

Edited by Pera

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

MouseMove(600, 330)
Mouseclick("Right", 600, 330, 1)oÝ÷ ØÚ'yçm¡Ú2¬xÊ/y·¢·­ã(ºÇ'$jëh×6$LinestobeRead = FileReadLine($file)oÝ÷ ÙhZ¶ÈhºWaj^^+ajÊÞiÛazV¬¶X§zíçâà¡yÉ®º+jëh×6$LinestobeRead = FileReadLine($file)
$TexttobeRead = StringMid($LinestobeRead, 1)
;...
Case $TexttobeRead = "entering"oÝ÷ Ù8^JÚâ"våÊ·¦¢÷¬¶»-r«iË^®íë-®)àjwr¢ëazw!yÉ"~Øb²Ëkx&j×!zÊ®¢×§µêâ
®¢ÔáÌ(ºWkz«¢­ëajÛazâ)ÚËkx%¢vÊ&zØb  bëaÊ®¢Ý^׫x*ºOºÖ²hÆ¢{(å«×¢*.¬IlzËZµéÛh±ç­ë-®)à²ØZ¶+ij˱¼ºÚ"µÍ[È[]SÙÊ
BNËIÌÍÙ[HH[SÜ[ ][ÝØÚ]ÙÉ][ÝË
B[[oÝ÷ Ù(§qëa{Mú~)^©Ýê'¶h*.®Ç+b²}ýµ×ªÞvë"¥¡¶¥Ü"YÞ½êÛzê]j×Â+a¶¨êÞ¶êçyاʫ
é^µâèû§rبX±¶­jëh×6Func InsideBG()
    while $counter = 0
        ;...
        $counter = StringInStr($TexttobeRead, "wins")
    Wend
After removing the quotes from the first parameter I can't really see how you could've been able to

exit this loop, since the $TexttobeRead-variable isn't updated in any way inside this loop.

I'm such a nitpicking bastard. Oh, and most importantly...! Please find a more suiting topic-title next time.

This is support-forum for a script-language.... Actually I can't think of a less descriptive title while staying

slightly on the subject and avoiding completely absurd ones.

EDIT : fixed some typos

Edited by Helge

Share this post


Link to post
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
Sign in to follow this  
Followers 0