Difference between revisions of "User:Starrynte/Melee Evaluator"
Jump to navigation
Jump to search
m (edited link) |
RednaxelaBot (talk | contribs) m (Using <syntaxhighlight>.) |
||
Line 4: | Line 4: | ||
1. Copy [[User:Starrynte/Melee Evaluator Source|the code here]] and paste it into a new class called MeleeEvaluate | 1. Copy [[User:Starrynte/Melee Evaluator Source|the code here]] and paste it into a new class called MeleeEvaluate | ||
2. Change the package to yours and compile the code | 2. Change the package to yours and compile the code | ||
− | 3. Add this to your bot's code, where the variables are: < | + | 3. Add this to your bot's code, where the variables are: <syntaxhighlight>static MeleeEvaluate me;</syntaxhighlight> |
− | 4. Then, inside run(), but outside the infinite loop (right after public void run() ), copy and paste this code: < | + | 4. Then, inside run(), but outside the infinite loop (right after public void run() ), copy and paste this code: <syntaxhighlight> |
if(me==null){ | if(me==null){ | ||
me=new MeleeEvaluate(this); | me=new MeleeEvaluate(this); | ||
Line 16: | Line 16: | ||
go.setPriority(100); | go.setPriority(100); | ||
addCustomEvent(go); | addCustomEvent(go); | ||
− | </ | + | </syntaxhighlight> |
If your bot uses blocking calls, make sure this code goes before the blocking calls in run() | If your bot uses blocking calls, make sure this code goes before the blocking calls in run() | ||
− | 5. Finally, copy and paste this code right outside run() (like onScannedRobot): < | + | 5. Finally, copy and paste this code right outside run() (like onScannedRobot): <syntaxhighlight> |
public void onCustomEvent(CustomEvent e){ | public void onCustomEvent(CustomEvent e){ | ||
me.execute(); | me.execute(); | ||
} | } | ||
− | </ | + | </syntaxhighlight> |
6. Compile your bot, run it in battles, and watch the console! | 6. Compile your bot, run it in battles, and watch the console! |
Latest revision as of 09:38, 1 July 2010
A utility that provides stats on your bot's performance in melee battles (currently only supports AdvancedRobot and battles with an even number of bots, and even then the standard 10 bots a battle is recommended).
How to Use
1. Copy the code here and paste it into a new class called MeleeEvaluate 2. Change the package to yours and compile the code
3. Add this to your bot's code, where the variables are:
static MeleeEvaluate me;
4. Then, inside run(), but outside the infinite loop (right after public void run() ), copy and paste this code:
if(me==null){
me=new MeleeEvaluate(this);
}
Condition go=new Condition("go"){
public boolean test(){
return true;
}
};
go.setPriority(100);
addCustomEvent(go);
If your bot uses blocking calls, make sure this code goes before the blocking calls in run()
5. Finally, copy and paste this code right outside run() (like onScannedRobot):
public void onCustomEvent(CustomEvent e){
me.execute();
}
6. Compile your bot, run it in battles, and watch the console!