mirror of
https://github.com/gooba42/AdventureLandScripts.git
synced 2026-10-14 11:59:30 -05:00
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
// Hey there!
|
|
// This is CODE, lets you control your character with code.
|
|
// If you don't know how to code, don't worry, It's easy.
|
|
// Just set attack_mode to true and ENGAGE!
|
|
|
|
var attack_mode = false
|
|
|
|
setInterval(function () {
|
|
|
|
use_hp_or_mp();
|
|
loot();
|
|
|
|
if (!attack_mode || character.rip || is_moving(character)) return;
|
|
|
|
var target = get_targeted_monster();
|
|
if (!target) {
|
|
target = get_nearest_monster({min_xp: 100, max_att: 120});
|
|
if (target) change_target(target);
|
|
else {
|
|
set_message("No Monsters");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!is_in_range(target)) {
|
|
move(
|
|
character.x + (target.x - character.x) / 2,
|
|
character.y + (target.y - character.y) / 2
|
|
);
|
|
// Walk half the distance
|
|
} else if (can_attack(target)) {
|
|
set_message("Attacking");
|
|
attack(target);
|
|
}
|
|
|
|
}, 1000 / 4); // Loops every 1/4 seconds.
|
|
|
|
// Learn Javascript: https://www.codecademy.com/learn/introduction-to-javascript
|
|
// Write your own CODE: https://github.com/kaansoral/adventureland
|
|
// NOTE: If the tab isn't focused, browsers slow down the game
|
|
// NOTE: Use the performance_trick() function as a workaround
|