I have uploaded version 0.3.1 of the Simple Macro Maker. It mostly contains some minor bugfixes and restructuring of the code. The break tag is now implemented and a bug occuring when trying to save invalid XML has been fixed. The new versions can be downloaded from the SMM download page.
<break> Breaks the current for or while loop.
The week has been fairly boring. I have fixed and added a few thing to the Darkfall Crafters page and it is now pretty much finished until the game is launched. That should mean that I should be able to do a lot of work on the SMM, but I just can't come up with anything new to add, hence the minor update.
I'm starting to think that the SMM project is finished for now. I can't come up with anything new and I probably won't be able to for a while. Normally that would mean that I would move on to a new project but I can't think of anything at the moment. I guess that making the DF crafters page drained my creativity quite a bit because of the speed of the project. I feel that I have done so much Delphi (and now also PHP) that I should probably switch to java or something for a while, the question still remains though: what should I make? If you have any suggestions then please contact me.
I have done a fair bit of tweaking of the Simple Macro Maker lately. As the title suggests I have uploaded v0.3 to the SMM section. I also moved the memory reading example from the SMM section (which has nothing to do with memory reading) to the resource mapping section (which has a lot to do with it).
Here's a list of some of the changes:
Things that only affect the source code:
The formats for the new tags:
<while condition=""> A while block with a boolean expression condition.
<break> Breaks the current for or while loop.
<end> Ends the macro. The macro automatically ends when it
runs out of lines so no need to place it in the end.
Note that the break tag is not in yet, it is on the to do list for the next versions.
A news entry about SMM wouldn't be complete without an example so here is one *smiles*. It shows how while loops, pixel recording and the end tag can be used. PixelToWatch is a location, InitialPixelColor and PixelColor are variables.
<set_variable>
<set_variable-name>InitialPixelColor</set_variable-name>
<set_variable-value>PixelToWatch</set_variable-value>
</set_variable>
<while condition="True">
<set_variable>
<set_variable-name>PixelColor</set_variable-name>
<set_variable-value>PixelToWatch</set_variable-value>
</set_variable>
<choose>
<choose-if condition="$PixelColor!=$InitialPixelColor">
<end/>
</choose-if>
</choose>
<wait base="500"/>
</while>
It will watch a pixel and end the macro (or do anything else that one wants) when that pixel changes color.
The Simple Macro Maker now also supports multiple operators. That means that one can use more than one operator in for example arithmetical or boolean expressions. This was accomplished by splitting the expressions into binary trees and then letting each node perform a single operator with the childrens' values.
Example:
<for iterations="5">
<wait base="500" random="0"/>
<print>$Counter*$Counter+1</print>
<set_variable>
<set_variable-name>Counter</set_variable-name>
<set_variable-value>$Counter+2*5</set_variable-value>
</set_variable>
</for>
Will now output:
2
122
442
962
1682
Before the program would have evaluated one operator and then tried to evaluate the values around it (which would make the example raise an error).
This is a picture to try to illustrate how the binary tree works. This tree evaluates the expression "4*3+2/1-2+6":
The root node then calls the two children nodes for their values, they call their children and so on. In the end the tree will have been evaluated from the bottom to the top. The priorities of different operations (/, *, -, + is highest priority to lowest) are reflected in that the operations with the highest priorities are placed as low as possible on the tree (as far away from the root as possible).
Variables have now been introduced in Simple Macro Maker v0.2.
The following new commands are now available in macro sequences:
<set_variable> Set a variable to a set value. [* <set_variable-name> The name of the variable. <set_variable-value> The value to set the variable to. *]
The variables' values can be referenced within the code by writing $<var_name> where <var_name> is the name of the variable. I.e. $MyVar evaluates as the value of the variable MyVar. Arithmetic expressions are now also allowed (currently only in <print> and <set_variable-value> but soon also in the <choose-if> conditions and where else it could fit).
Here's a short example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<macro>
<declarations>
<variable>
<variable-name>Counter</variable-name>
<variable-type>Integer</variable-type>
<variable-initial_value>1</variable-initial_value>
<variable-current_value>1</variable-current_value>
</variable>
</declarations>
<sequence>
<for iterations="5">
<wait base="500" random="0"/>
<print>$Counter*$Counter</print>
<set_variable>
<set_variable-name>Counter</set_variable-name>
<set_variable-value>$Counter+1</set_variable-value>
</set_variable>
</for>
</sequence>
</macro>
This code declares one variable (Counter) with the initial value 1 and then performs a loop. The loop iterates five time and each time the square of the current value of the variable Counter is printed and Counter is then increased by one.
The output is simply: 1 4 9 1625
A preliminary version of the macro program (now named Simple Macro Maker, or SMM) is complete and uploaded. It can be downloaded from the project's download page along with the current source code.
The current version is not in any way complete and does not support everything that I have planned for the project. The variables are present in the GUI but they can not be modified during runtime in the macro sequence code (yet).
Here's a picture of the program's main window with the sequence code, which describes what the macro should do.
This example basically clicks a button, prints "!2" five times and then loops back once before finishing. The code includes some pauses (the <wait> elements).