I comandi ‘If’ ed ‘Else’
If ed else sono utili per impostare dei comandi a seconda del risultato che produce lo script. Praticamente un vero/falso dove “if” è il “vero” mentre l’ “else” è il falso. Cioè se l’equazione “if” è soddisfatta viene automaticamente eseguito il comando seguente all’if stesso, altrimenti seguirà il comando “else” che comanderà solo se l’equazione “if” non è stata soddisfatta.
Vediamo un esempio:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
End
SetActiveWindow Untitled – Notepad
Loop 1
Keys $k1
If d1 < d2
Keys $k1
Else
Keys $k2
End
End
Spegazione passo-passo:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
End
SetActiveWindow Blocco note
Loop 1
Keys $k1
If $d1 < $d2 //Se il valore di $d1 è minore di $d2….
Keys $k1 //… viene premuto il tasto collegato alla variabile $k1
Else //Altrimenti…
Keys $k2 //… viene premuto il tasto collegato alla variabile $k2
End //termina l’if
End //termina lo script
Comandare il mouse
Vediamo i comandi per simulare l’utilizzo del mouse:
DrayTo X, Y – Dopo aver fatto click trascina il mouse in un altro punto dello schermo, utile ad esempio per una selezione multipla.
LeftClick – Schiaccia il tasto sinistro del mouse
LeftMouseDown – Schiaccia il tasto sinistro del mouse e lo tiene premuto
LeftMouseUp – Rilascia il tasto sinistro del mouse
DoubleClick – Esegue un doppio click con il tasto sinistro
MousePos X, Y – Sposta il mouse alle coordinate specificate (X asse orizzontale, Y asse verticale)
MouseIDItem X, Y – Identifica l’item sul quale è posizionato il mouse (Creato per il gioco Asheron’s Call, non è detto funzioni anche in altri giochi)
RightClick – Schiaccia il tasto destro del mouse
RightMouseDown – Schiaccia il tasto destro del mouse e lo tiene premuto
RightMouseUp – Rilascia il tasto destro del mouse
*IMPORTANTE*
Per trovare le coordinate di una determinata posizione del mouse è sufficiente premere CTRL-M quando il mouse è nella posizione desiderata. Le coordinate X e Y appariranno nello script.
Vediamo quindi uno script che muova il mouse e che usi tutte le funzioni del mouse
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
End
SetActiveWindow Blocco note //Sposta la finestra nell’angolo in alto a sinistra
Loop 1
MousePos 16, 58
Keydown $k1 5 sec
Delay $d2
MousePos 596, 58
Delay $d2
LeftMouseDown
Delay $d2
DragTo 16, 58
Delay $d2
MousePos 30, 58
Delay $d2
RightClick
Delay $d2
MousePos 88, 102
Delay $d2
RightClick
Delay $d2
Loop 5
Keys {RETURN}
End
MousePos 16, 143
Delay $d2
RightClick
Delay $d2
MousePos 68, 223
Delay $d2
LeftClick
End
Lo scirpt sembra complicato ma non lo è: in pratica preme la lettera “h” per 5 secondi, la taglia e la incolla.
La funzione Compute
Questa funzione è utile per eseguire semplici calcoli, tuttavia può essere utile in tantissime occasioni.
Quando si utilizza la funzione compute è meglio impostare un valore di appoggio temp=0 che crea appunto un valore temporaneo utile all’inizio di determinate funzioni.
Vediamo lo script:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
Temp = 0
Temp2 = 0
End
SetActiveWindow Untitled – Notepad
Loop 1
If $d1 < 501
Compute $d1 = $Temp
Keys $k1
Else Compute $d2 = $Temp2
Keys $k2
End
End
Vediamolo passo-passo:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
Temp = 0 //Definisce il primo valore temporaneo
Temp2 = 0 //Definisce il secondo valore temporaneo
End
SetActiveWindow Blocco note
Loop 1
If $d1 > 501 //Se il valore della variabile $d1 è maggiore di 501…..
Compute $d1 = $Temp //… modifica il valore di $temp nell’esatto valore di $d1
Keys $k1 //… e schiaccia il tasto associato a $k1
Else Compute $d2 = $Temp2 //… altrimenti, se il valore di $d1 fosse stato minore di 501, avrebbe cambiato il valore di $temp2 con il valore di $d2
Keys $k2 //… successivamente avrebbe premuto il tasto associato a $k2
End
End
Ancora un esempio di questa funzione, lo SmartBot per selezionare un personaggio:
Constants
Character = 2
CharacterX = 258
CharacterXOffset = 124
CharacterY = 371
Temp = 0
Temp2 = 0
End
Procedure SelectCharacter
If $Character = 1
Compute Temp = $Character //Temp diventa uguale ad 1 se $Character è uguale a 1
Else
Compute Temp = $Character * $CharXOffset //se $Character ha un qualsiasi valora diverso da , viene moltiplicato il valore di $Character per $CharXOffset (distanza tra i personaggi) , ed il valore risultante con il risultato
End
Compute Temp = $Temp + $CharacterX //Somma il valore di $Temp con il valore di $CharacterX e con il risultato crea il nuovo valore di Temp
MousePos $Temp, $CharacterY //Sposta il mouse alle coordinate X,Y specificate: il valore X è il valore di Temp, il valore di Y è il valore di CharacterY
End
SetActiveWindow MapleStory
Call SelectCharacter //Avvia la procedura SelectCharacter
End //Potrebbe sembrare uno script complicato ma basta leggerlo con attenzione per capirlo perfettamente
Leggettura della memoria
Questo script è un pochino complicato…. vediamolo assieme:
Constants
MaxPeople = 0
NumberPeople = 0
PeoplePointer = 0
Temp = 0
End
Procedure PeopleTest
ReadMemory PeoplePointer = 0077F60C //valore da aggiornare in base all’ultima versione del gioco
Compute PeoplePointer = $PeoplePointer + 24
DecToHex PeoplePointer = $PeoplePointer
ReadMemory NumberPeople = $PeoplePointer
If $NumberPeople > $MaxPeople
Call ChangeChannel
End
End
Procedure ChangeChannel
Keys {ESC}
Delay 100
Keys {RETURN}
Delay 100
Keys {RIGHT}
Delay 100
Keys {RETURN}
Delay 5000
End
SetActiveWindow MapleStory
While 1=1
Call PeopleTest
EndLets break it down
Vediamo il codice passo-passo:
Constants
MaxPeople = 0 //Massimo numero di personaggi sulla mappa
NumberPeople = 0 //Minimo numero di personaggi sulla mappa
PeoplePointer = 0 //Lasciare il valore a zero oppure impostarne uno differente
Temp = 0 //valore temporaneo
End
Procedure PeopleTest
ReadMemory PeoplePointer = 0077F60C //Imposta l’indirizzo di memoria usato dal gioco (dovrà essere aggiornato ad ogni aggiornamento del gioco)
Compute PeoplePointer = $PeoplePointer + 24 //24 è il puntatore esadecimale nel formato decimale
DecToHex PeoplePointer = $PeoplePointer //trasforma il valore decimale in esadecimale
ReadMemory NumberPeople = $PeoplePointer //assegna il valore PeoplePointer a Number People
If $NumberPeople > $MaxPeople //se NumberPeople è + grande di MaxPeople allora…
Call ChangeChannel //cambia canale chiamando l’omonima procedura
End
End
Procedure ChangeChannel //procedura x cambiare canale
Keys {ESC}
Delay 100
Keys {RETURN}
Delay 100
Keys {RIGHT}
Delay 100
Keys {RETURN}
Delay 5000
End
SetActiveWindow MapleStory
While 1=1
Call PeopleTest //Richiama PeopleTest
End
Leggere i colori
Questo script legge il colore del pixel ad una certa coordinata ed esegue una azione in base al colore
Constants
HpPercent = 30 //Valore minimo di HP (in percentuale) da raggiungere prima di fermarsi a recuperare
MpPercent = 5 //Valore minimo di MP (in percentuale) da raggiungere prima di fermarsi a recuperare
HpKey = {DEL} //Tasto per recupero HP
MpKey = {PGDN} //Tasto recupero MP
PotionDelay = 100 //Attesa tra un recupero ed il successivo
HpX = 264 //Coordinata X della parte iniziale della barra HP
MpX = 349 //Coordinata X della parte iniziale della barra MP
HPMPY = 619 //Coordinata Y delle barre HP ed MP (sono evidentemente sulla madesima riga)
Temp = 0 //solito valore temporaneo
End //*IMPORTANTE* le barre HP e MP MapleStory sono lunghe solo 102 pixel
Procedure AutoPot
Compute Temp = $HpX + $HpPercent //Cerca l’esatta coordinata X per comandare il recupero di HP
IsGrey $Temp, $HPMPY //Quindi controlla le coordinate X, Y per vedere se il pixel è grigio…
Keys $HpKey //preme quindi il pulsante associato alla variabile $HpKey per recuperare HP
Delay $PotionDelay //Pausa di 0.1 secondi per non incorrere nell’errore di flood o spam (premere troppe volte troppo velocemente un tasto)
End
Compute Temp = $MpX + $MpPercent //Cerca l’esatta coordinata X per comandare il recupero di MP
IsGrey $Temp, $HPMPY //Quindi controlla le coordinate X, Y per vedere se il pixel è grigio…
Keys $MpKey //preme quindi il pulsante associato alla variabile $MpKey per recuperare MP
Delay $PotionDelay //Pausa di 0.1 secondi per non incorrere nell’errore di flood o spam (premere troppe volte troppo velocemente un tasto)
End
Ecco, la guida è completa! Si accettano commenti per ampliarla e migliorarla!
IN INGLESE:AC Tool Guide
Learn how to use it, control it, and pwn with it
This guide is just going to be on how to use AC Tools and is suppose to be for people that want to learn it, but don't really know where to start. Ok so here we go
AC Tools is a program written by Cameron Scott Cole and David Smith (OnceBitten)
You can download it at their homepage
[Devi essere iscritto e connesso per vedere questo link]It was originally made for a game called Asheron's Call so you could basically bot with it, just like we use it. It inputs keystokes and mouse clicks to a specific program that you chose, like a robot, you tell it to do something and it does it.
Ok lets learn some of the basic commands and how to make a basic macro
SetActiveWindow - A needed command that must be a the top of every macro u make, because it makes it so when u press start, you should automatically switch programs to the one u set your macro too. Also needed for memory functions.
Keys - Sends a keystoke to the program you have selected and it will tell the program thru almost like virtual keyboard that the button was pressed
Delay - Make the macro wait a specific amount of time before doing the next task .1 sec = 1000 Delay
End - Stops the current loop, function or macro. Used for most things, such as Loops, Procedures, Constants, and many more. But you'll learn later on.
Loop - Loops your macro a set number of time, need an end statement for every loop statement
Ok now we know wat the basic statements are of AC Tools so lets try making a simple bot, that will say hello
Code:
SetActiveWindow Untitled - Notepad
Loop 1
Keys hello
Delay 1000
EndSo lets break this down to see wat AC Tool is telling Notepad
Code:
SetActiveWindow Untitled - Notepad //Makes AC Tool switch to and read NotePad.exe if it is open
Loop 1 //Make the macro repeat 1 times
Keys Hello //Imputs the keystrokes 'h' 'e' 'l' 'l' 'o' into notepad
Delay 1000 //Wait for 1 second before continuing
End //Stops the Loop statement that we defind earlierIf you were to run that, with NotePad open, it would just type hello, wait 1 second and the stop running.
There are more variations on this simple scrïpt like this
Code:
SetActiveWindow Untitled - Notepad
While 1=1
Keydown H 5 sec
Delay 1000
EndLets break this one down
Code:
SetActiveWindow Untitled - Notepad //You know what this means so i won't say anything about it from now on
While 1=1 //A 'While' statement that if 1 is equal to 1 the scrïpt will repeat itself
Keydown H 5 sec //A variation of the 'Keys' function, this just press the key down for a certian ammount of time
Delay 1000 //Wait for 1 second before continuing
End //End's the current function, but since the While statement is there and 1 = 1 it's like the end doesn't exist anymore, (just this one tho)Now go write some basic scrïpts and play around with AC Tools until you figure out something. But my advice is to find other's scrïpts and learn off of there's, break them down and figure out how they tick. This is the best way to learn here.
Lets try some harder stuff now, with 2 new functions. The Procdure and Constants statements
Procedure - It's a routine basically that you can access anywere in the macro, so cutting down on the size of your scrïpt and is alot ezier to change that going thru a massive scrïpt and changing this on thing at a time. You define wat you want a Procedure to do and End it, then someone later on in the scrïpt you can 'Call' it and it will preform the procedure
Call - Calls a procedure and preforms it
Constants - Indentifies that you set at the start of the macro, same thing as a function, basically makes scrïpts more easily change able and user friendly. You can define keys, values, and other things as Constants
Lets make a scrïpt using these new statements now:
Procedure statement
Code:
Procedure 1
Keys h
End
Procedure 2
Delay 1000
End
SetActiveWindow Untitled - Notepad
Loop 1
Call 1
Call 2
Call 1
EndLets break this down
Code:
Procedure 1 //Defines the following tasks as procedure as 1
Keys h // Press the 'h' key
End //Stops defining for the procedure '1'
Procedure 2 //Defines the following tasks as procedure as 2
Delay 1000 //Delay for 1 second
End //Stops defining for the procedure '2'
SetActiveWindow Untitled - Notepad
Loop 1 //Repeat once
Call 1 //"Calls" the procedure defined as 1 and preforms it
Call 2 //"Calls" the procedure defined as 2 and preforms it
Call 1 //"Calls" the procedure defined as 1 and preforms it
End //Ends the macroSo it would look like this, if you ran it
hh
with a second pause inbetween the h's
Now lets look at the Constants statement
Code:
Constants
k1 = h
d1 = 1000
End
SetActiveWindow Untitled - Notepad
Loop 1
Keys $k1
Delay $d1
EndNow lets break it down
Code:
Constants //Defines constants
k1 = h //defines that all $k1 statements in the scrïpt are now to be h
d1 = 1000 //defines that all $d1 statements in the scrïpt are now recognized as 1000
End
SetActiveWindow Untitled - Notepad
Loop 1
Keys $k1 //instead of telling it u want to press k1 it presses wat u have desinated as k1
Delay $d1 //instead of telling it to do delay for d1 it delays for how much u set the value of d1 for
EndNotice how i put a "$" sign in front of the constants when i wanted them in the scrïpt? YOU MUST HAVE this infront of a constant if u want to call it otherwise actool would just see it as k1 instead of h.
I would advise now that you figure out a little more of AC Tool before going on because it will bet much more complex if you don't know wat u r doing.
The 'If' and 'Else' statement
This is for bots that read something, and have more than one option of things to do depending on wat it reads. Basically a True/False statement. The 'Else' statement conensids with the 'If'. Else is like the False statement.
Lets see an example
Code:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
End
SetActiveWindow Untitled - Notepad
Loop 1
Keys $k1
If d1 < d2
Keys $k1
Else
Keys $k2
End
EndLets break it down again
Code:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
End
SetActiveWindow Untitled - Notepad
Loop 1
Keys $k1 //Presses wat is defined as k1
If $d1 < $d2 //Compares d1 value with the d2 value
Keys $k1 //If d1 is smaller than d2 then press the key defined as k1
Else //If that statement is wrong then:
Keys $k2 //Press the key defined as k2
End //End the 'If' statement
EndSo it would look like this with the current Constants:
hg
But if you were to switch the values of d1 and d2 it would look like this:
hh
So again, play around with 'If' and 'Else' statements until you get used to using them
Lets learn how to use the mouse now.
These all all the commands that you can use the mouse with
DrayTo X, Y - After you click on a place, you drag the mouse to another point on your screen. Used for selection, applying something, etc
LeftClick - Press the Left Mouse Button
LeftMouseDown - Press down the Left Mouse Button and hold
LeftMouseUp - Release the Left Mouse Button
DoubleClick - Double clicks the left mouse button
MousePos X, Y - Moves the mouse to the co-ords u specified
MouseIDItem X, Y - Identifies the item that the mouse is on (I'm not going to cover this since it's just for Asheron's Call)
RightClick - Press the Right Mouse Button
RightMouseDown - Press down the Right Mouse Button and hold
RightMouseUp - Release the Right Mouse Button
*IMPORTANT*
How to find you current Mouse Position, just press Ctrl-M when you mouse is on the place you want it to be and a MousePos X, Y will show up on the scrïpt with the co-ords in the place of the X and Y
Lets make a scrïpt to move the mouse using all these functions
Code:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
End
SetActiveWindow Untitled - Notepad //Move window to top left corner
Loop 1
MousePos 16, 58
Keydown $k1 5 sec
Delay $d2
MousePos 596, 58
Delay $d2
LeftMouseDown
Delay $d2
DragTo 16, 58
Delay $d2
MousePos 30, 58
Delay $d2
RightClick
Delay $d2
MousePos 88, 102
Delay $d2
RightClick
Delay $d2
Loop 5
Keys {RETURN}
End
MousePos 16, 143
Delay $d2
RightClick
Delay $d2
MousePos 68, 223
Delay $d2
LeftClick
EndI'm not going to break this one down since it's self explainitory, but wat it should do is type 5 seconds of the letter h, cut it, and then hit enter 5 times and paste it there.
The Compute Function
This function basically is a little calculator that u can use to figure out stuff in AC Tools, the main place i use it is when i'm reading or writing memory in a game. But it has alot of functions.
When using the compute statement i would advise that you make a Temp = 0 because this creates a scratchpad for AC Tool's, like below:
//Temp means Temperary
Code:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
Temp = 0
Temp2 = 0
End
SetActiveWindow Untitled - Notepad
Loop 1
If $d1 < 501
Compute $d1 = $Temp
Keys $k1
Else Compute $d2 = $Temp2
Keys $k2
End
EndBreaking it down......
Code:
Constants
k1 = h
k2 = g
d1 = 1000
d2 = 500
Temp = 0 //Defines 1st Scratch pad
Temp2 = 0 //Defines 2nd Scratch pad
End
SetActiveWindow Untitled - Notepad
Loop 1
If $d1 > 501 //If the value of d1 is larger than 501 then.....
Compute $d1 = $Temp //Make the value of the Temp be the same as the value of d1
Keys $k1 //Then press h key
Else Compute $d2 = $Temp2 //If the value of d1 is less than 501 set the value of the Temp2 be the same as the value of d2
Keys $k2 //Then press the g key
End
EndAnother exampe of the Computer Function is in my SmartBot, Procedure Selecting a Character
Code:
Constants
Character = 2
CharacterX = 258
CharacterXOffset = 124
CharacterY = 371
Temp = 0
Temp2 = 0
End
Procedure SelectCharacter
If $Character = 1
Compute Temp = $Character //Makes Temp = 1 if $Character is = to 1
Else
Compute Temp = $Character * $CharXOffset //If $Character is anything other than 1, multiply the value of $Character by the $CharXOffset (distance between characters) and make that the Temp value
End
Compute Temp = $Temp + $CharacterX //Add the $Temp value that we computed be4 and at the $CharacterX value and make that the new Temp value
MousePos $Temp, $CharacterY //Move your mouse to the position that is X = Temp value and Y = CharacterY value
End
SetActiveWindow MapleStory
Call SelectCharacter //Do the SelectCharacter procedure
EndThis might be jumping forward to fast for some of you but it's pretty ez to understand if you can just think about it for a second
Reading the Memory
Ok this will get really complicated so just look it over for a while and try to understand it, I will
try to get as detailed as I can
I use the people scanner from my smart bot as my example
Code:
Constants
MaxPeople = 0
NumberPeople = 0
PeoplePointer = 0
Temp = 0
End
Procedure PeopleTest
ReadMemory PeoplePointer = 0077F60C //needs to be updated for newest version
Compute PeoplePointer = $PeoplePointer + 24
DecToHex PeoplePointer = $PeoplePointer
ReadMemory NumberPeople = $PeoplePointer
If $NumberPeople > $MaxPeople
Call ChangeChannel
End
End
Procedure ChangeChannel
Keys {ESC}
Delay 100
Keys {RETURN}
Delay 100
Keys {RIGHT}
Delay 100
Keys {RETURN}
Delay 5000
End
SetActiveWindow MapleStory
While 1=1
Call PeopleTest
EndLets break it down
Code:
Constants
MaxPeople = 0 //Max number of people you want on map
NumberPeople = 0 //Minumum ammount of people you want on map
PeoplePointer = 0 //Just leave at 0 or you can set it to the base address
Temp = 0 //ACTool scratch paper
End
Procedure PeopleTest
ReadMemory PeoplePointer = 0077F60C //Set address here so it reads the games memory at the proper location//needs to be updated for newest version
Compute PeoplePointer = $PeoplePointer + 24 //24 is the hex pointer in decimal form
DecToHex PeoplePointer = $PeoplePointer //Changes the decimal value to hex
ReadMemory NumberPeople = $PeoplePointer //Changes PeoplePointer to the Number People
If $NumberPeople > $MaxPeople //If the NumberPeople is larger than the MaxPeople then...
Call ChangeChannel //Change Channel
End
End
Procedure ChangeChannel //Changes channels, pretty straight forwar
Keys {ESC}
Delay 100
Keys {RETURN}
Delay 100
Keys {RIGHT}
Delay 100
Keys {RETURN}
Delay 5000
End
SetActiveWindow MapleStory
While 1=1
Call PeopleTest //Run PeopleTest forever until told to stop
End
Reading Colors
This part is making ACTool's read color's at a certian spot on the screen and doing an action if it is or not a color
I'll be using my AutoPot for an example
Code:
Constants
HpPercent = 30
MpPercent = 5
HpKey = {DEL}
MpKey = {PGDN}
PotionDelay = 100
HpX = 264
MpX = 349
HPMPY = 619
Temp = 0
End
Procedure AutoPot
Compute Temp = $HpX + $HpPercent
IsGrey $Temp, $HPMPY
Keys $HpKey
Delay $PotionDelay
End
Compute Temp = $MpX + $MpPercent
IsGrey $Temp, $HPMPY
Keys $MpKey
Delay $PotionDelay
End
End
SetActiveWindow MapleStory
While 1=1
Call AutoPot //Run AutoPot forever until told to stop
End
Lets break this one down
Code:
Constants
HpPercent = 30 //How low you want you HP to go down before it pots again
MpPercent = 5 //How low you want you MP to go down before it pots again
HpKey = {DEL} //HP pot key
MpKey = {PGDN} //MP pot key
PotionDelay = 100 //Delay between when another pot can be used
HpX = 264 //X co-ord of the start of your HP bar
MpX = 349 //X co-ord of the start of your MP bar
HPMPY = 619 //Y co-ord of your HP and MP bars
Temp = 0 //ACTool scratch paper
End
//*IMPORTANT NOTE* the HP and MP bars in MS are only 102 pixels long so they made it quite helpful to us
Procedure AutoPot
Compute Temp = $HpX + $HpPercent //Find out exact X axis spot of when you want to get a pot
IsGrey $Temp, $HPMPY //Looks at the X, Y location and if it is Grey...
Keys $HpKey //press the Delete key, what ever you have you HP pot set too
Delay $PotionDelay //Pauses for 0.1 sec so you won't run into the error of pot spamming
End
Compute Temp = $MpX + $MpPercent //Find out exact X axis spot of when you want to get a pot
IsGrey $Temp, $HPMPY //Looks at the X, Y location and if it is Grey...
Keys $MpKey //press the PageDown key, what ever you have you MP pot set too
Delay $PotionDelay //Pauses for 0.1 sec so you won't run into the error of pot spamming
End