-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsavedFunctions.txt
More file actions
175 lines (139 loc) · 3.69 KB
/
savedFunctions.txt
File metadata and controls
175 lines (139 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
function use_hp_or_mp_fixed()
{
if(safeties && mssince(last_potion)<min(200,character.ping*3)) return;
var used=false;
// On cooldown?
if(new Date()<parent.next_skill.use_hp) return;
// In dire need of mana?
if(character.mp/character.max_mp<0.2) use('use_mp'),used=true;
// Potion use justified?
else if(character.hp/character.max_hp<0.8) use('use_hp'),used=true;
else if(character.mp/character.max_mp<0.7) use('use_mp'),used=true;
// Anything to regen without wasting?
// Prefer MP as HP is less effective.
else if(character.mp<character.max_mp - 100) use('regen_mp'),used=true;
else if(character.hp<character.max_hp - 50) use('regen_hp'),used=true;
// Anything to regen at all?
else if(character.hp<character.max_hp) use('regen_hp'),used=true;
else if(character.mp<character.max_mp) use('regen_mp'),used=true;
if(used) last_potion=new Date();
}
function in_town(entity)
{
if (entity.map === "main")
{
if (entity.x < -600) return false;
if (entity.x > 360) return false;
if (entity.y < -909) return false;
if (entity.y > 530) return false;
return true;
}
return false;
}
// 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=true;
var move_to_engage = true;
load_code(2);
setInterval(function(){
use_hp_or_mp_fixed();
loot();
if(!attack_mode || character.rip) return;
if(is_moving(character) || is_transporting(character)) return;
if(in_town(character)) return;
var target=get_targeted_monster();
if(!target)
{
target=get_nearest_monster({min_xp:100,max_att:330});
if(target) change_target(target);
else
{
set_message("No Monsters");
return;
}
}
if(!is_in_range(target))
{
if (!move_to_engage) return;
move(
character.x+(target.x-character.x)*0.13,
character.y+(target.y-character.y)*0.13
);
// Walk half the distance
}
else if(can_attack(target))
{
set_message("Attacking");
attack(target);
//move(character.x, character.y - 0);
}
},1000/16 + 5);
// Learn Javascript: https://www.codecademy.com/learn/introduction-to-javascript
// Write your own CODE: https://github.com/kaansoral/adventureland
load_code(2);
setInterval(function(){
use_hp_or_mp_fixed();
},1000/10); // Loops every 1/8 seconds.
var i = 0;
setInterval(function(){
i = (i+1) % 40;
if (is_moving(character)) return;
switch (i)
{
case 1: move(character.x-0.00001, character.y); break;
case 4: move(character.x, character.y+0.00001); break;
case 15: move(character.x+0.00001, character.y); break;
case 21: move(character.x, character.y+0.00001); break;
default: break;
}
},1000/2);
let phi = 0;
let radius = 40;
setInterval(function() {
let bean = 0;
for(id in parent.entities)
{
var current=parent.entities[id];
if (current.name == "MoneyS") {
bean = current;
break;
}
}
move(bean.x + radius * Math.cos(phi), bean.y + radius * Math.sin(phi));
phi -= 0.35;
}, 200);
let iD = [];
let toggle = false;
function d(name){
let boo = true;
for(let i in iD){
if(name===iD[i]){
boo=false;
break;
};
};
if(boo) iD.push(name);
return boo;
};
setInterval(function(){iD=[];},2000);
function p(){
let player = null;
for(let id in parent.entities){
let current = parent.entities[id];
if(current.type!=="character") continue;
if(d(current.id)) {
player = current;
break;
};
};
if (player)
if (toggle)
send_gold(player.name,206);
else
if (parent.distance(character,player) < 320)
use_skill("mluck", player);
toggle = !toggle;
};
//setInterval(function(){p()}, 100)