Page 1 of 1

Infinite Loop and Pixel Search

Posted: 16 Apr 2012, 12:05
by camthalion
Hello I am really new to this program and I hope someone can help me, i am having trouble using "Infinite Loop and Pixel Search"

I am trying to use it in a game, I want to to use "F1" when my HP goes low.

Can someone help me how?

Re: Infinite Loop and Pixel Search

Posted: 16 Apr 2012, 12:38
by Jmgr
Hi,

What you could do is to check the color of a pixel of your HP bar (it depends on the game of course) to see when it goes low.
When it is not the case ("If false" parameter), wait. If it is the case ("If true" parameter), do nothing. (this will execute the next action)
This next action is a "Key" action that presses "F1".

Here is an example: (go to File->Import->Script content to import it)

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.4.1" scriptVersion="1.0.0" os="Windows"/>
    <actions>
        <action name="ActionKey" version="1.0.0"/>
        <action name="ActionPixelColor" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="0" pauseAfter="0">
        <action name="ActionPixelColor" comment="Wait for the HP to be low">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="comparison">
                <subParameter name="value" code="0">equal</subParameter>
            </parameter>
            <parameter name="greenTolerance">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="blueTolerance">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="redTolerance">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="ifTrue">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">do_nothing</subParameter>
            </parameter>
            <parameter name="ifFalse">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">wait</subParameter>
            </parameter>
            <parameter name="pixel">
                <subParameter name="position" code="0">1487:305</subParameter>
                <subParameter name="color" code="0">255:255:255</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="Press F1">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="33" action="0" line=""/>
            <parameter name="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">F1</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>

Re: Infinite Loop and Pixel Search

Posted: 16 Apr 2012, 13:34
by camthalion
I have done everything. I have inserted the Pixel value but why does the program close after it executes? here is my code
please check what im doing wrong

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.0.0" scriptVersion="1.0.0" os="Windows"/>
    <actions>
        <action name="ActionPixelColor" version="1.0.0"/>
        <action name="ActionKey" version="1.0.0"/>
        <action name="ActionWindow" version="1.0.0"/>
        <action name="ActionWindowCondition" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="0" pauseAfter="0">
        <action name="ActionWindow">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="33" action="0" line=""/>
            <parameter name="title">
                <subParameter name="value" code="0">MyRO! My Ragnarok Online</subParameter>
            </parameter>
            <parameter name="resizeHeight">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">setForeground</subParameter>
            </parameter>
            <parameter name="movePosition">
                <subParameter name="value" code="0">:</subParameter>
            </parameter>
            <parameter name="resizeWidth">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
        </action>
        <action name="ActionWindowCondition">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="width">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0">MyRO! My Ragnarok Online</subParameter>
            </parameter>
            <parameter name="condition">
                <subParameter name="value" code="0">exists</subParameter>
            </parameter>
            <parameter name="processId">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="height">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="ifTrue">
                <subParameter name="line" code="1">002</subParameter>
                <subParameter name="action" code="0">run_code</subParameter>
            </parameter>
            <parameter name="ifFalse">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">wait</subParameter>
            </parameter>
            <parameter name="yCoordinate">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="xCoordinate">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
        </action>
        <action name="ActionPixelColor" comment="Wait for the HP to be low">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="comparison">
                <subParameter name="value" code="0">equal</subParameter>
            </parameter>
            <parameter name="greenTolerance">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="variable">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="blueTolerance">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="redTolerance">
                <subParameter name="value" code="0">0</subParameter>
            </parameter>
            <parameter name="ifTrue">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">do_nothing</subParameter>
            </parameter>
            <parameter name="ifFalse">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">wait</subParameter>
            </parameter>
            <parameter name="pixel">
                <subParameter name="position" code="0">382:138</subParameter>
                <subParameter name="color" code="0">156:181:239</subParameter>
            </parameter>
        </action>
        <action name="ActionKey" comment="Press F1">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <exception id="33" action="0" line=""/>
            <parameter name="alt">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="action">
                <subParameter name="value" code="0">pressRelease</subParameter>
            </parameter>
            <parameter name="meta">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="key">
                <subParameter name="key" code="0">F1</subParameter>
                <subParameter name="isQtKey" code="0">true</subParameter>
            </parameter>
            <parameter name="ctrl">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="shift">
                <subParameter name="value" code="0">false</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">win32</subParameter>
            </parameter>
            <parameter name="pause">
                <subParameter name="value" code="0">10</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>

Re: Infinite Loop and Pixel Search

Posted: 16 Apr 2012, 23:14
by Jmgr
Could you test it using the latest version of Actionaz ?
It is available on my website : http://www.jmgr.net

Line 2 you set the "If true" action to "run code", but "002" is not valid JavaScript code. You should instead choose "Do nothing".

Re: Infinite Loop and Pixel Search

Posted: 17 Apr 2012, 10:52
by camthalion
I still encounter the same problem, the execution window closes -- I do not see any error :(
what could i be doing wrong? I cannot get it to loop.

Re: Infinite Loop and Pixel Search

Posted: 17 Apr 2012, 12:21
by Jmgr
The program crashes if you run this script ?
I cannot reproduce this bug on my computer.

What Windows version are you using ?

Re: Infinite Loop and Pixel Search

Posted: 18 Apr 2012, 02:34
by camthalion
Im using windows 7.

The script works, but my problem is that the "Execute window" (the new window that will appear after pressing the red circle icon thingy [crtl + space]) will close after doing the script once.

I think the problem is that on the "Loop" option for Actionaz, there is no infinite loop.

I am not quite familiar with the language used in Actionaz, but I have another script in BlueEye Macro, this is somewhat I want to do. http://www.blueeye-macro.com/viewtopic.php?f=434&t=4698. I hope this helps:

Code: Select all

if  Color.At coordinate is not (RGB)("186", "18", "25", "182", "100")
     begin
          Keyboard.Press key("q")
          Macro.Pause("500")
     end
 if  Color.At coordinate is not (RGB)("18", "67", "181", "172", "113")
     begin
          Keyboard.Press key("w")
          Macro.Pause("500")
     end
 if  Color.At coordinate is not (RGB)("89", "84", "58", "72", "160")
     begin
          if  Color.At coordinate is not (RGB)("183", "18", "23", "173", "150")
               begin
                    Keyboard.Press key("e")
                    Macro.Pause("500")
               end
          if  Color.At coordinate is not (RGB)("20", "69", "182", "171", "163")
               begin
                    Keyboard.Press key("r")
                    Macro.Pause("500")
               end
     end

Re: Infinite Loop and Pixel Search

Posted: 18 Apr 2012, 07:42
by Jmgr
Ah ok, I understand you know ^^

Well you only have to add a Goto action at the end of the script.
In the parameter "Line", enter 1. (or select 001)
This will "jump" at the start of the script when it reaches the end, doing an infinite loop.