上下馬
// 0x25E自己 0x115馬
if (client.findType(0x115)) {
player.useType(0x115);
} else {
player.useType(0x25E);
}
魔法類 – web
while (true) {
var a = player.getSkill(Skills.Magery).value;
if (player.mana > 30) {
if (a >= 0 && a < 300) {
player.cast(Spells.Cure);
target.wait();
target.self();
sleep(100);
}
if (a >= 300 && a < 600) {
player.cast(Spells.GreaterHeal);
target.wait();
target.self();
sleep(100);
}
if (a >= 600 && a < 800) {
player.cast(Spells.Invisibility);
target.wait();
target.self();
sleep(100);
}
if (a >= 800 && a < 1000) {
player.cast(Spells.MassDispel);
target.wait();
target.self();
sleep(100);
}
} else {
sleep(500);
player.useSkill(Skills.Meditation);
sleep(30000);
}
}
伐木 – 不能騎座騎好像會擋到樹 – web
// 以下需要修改的
// 本來打算寫走路找樹的, 但XY搞死我了 0是RECALL 1是走路找樹
const walktolj = 0;
// 銀行或家的符石書
const bankbook = 0x405EC38B;
// 銀行裡放木頭的箱子
const bankbagforlog = 0x40827DEB;
// 樹的點的符石書 如果有增加, 自己加上去記得改startljbookno
const ljbook1 = 0x40525DC4;
const ljbook2 = 0x40330ABA;
const ljbook3 = 0x403304DF;
const ljbook4 = 0x40330B54;
const ljbook5 = 0x40330650;
var startljbookno = 5;
var startljbook = 1;
// 斧
const axe = 0x4059ECD2;
// recall 後的等待時間 視LAG情況調整
const recalltime = 4000;
// 每次伐木的等待時間 視LAG情況調整
const chopwaittime = 1000;
// 以下不用改
const logd = 0x1BDD;
// 這個值加上負重, 大於最大值, 才會回去放
const plweight = 100;
// 走路找樹的掃描範圍
const rx = 5;
const ry = 5;
// 不用改
var ljno = 50;
// 掛了一下發現會伐到一些雜物
const amber = 0x3199;
const plant = 0x3190;
const bark = 0x318F;
const fungi = 0x3191;
const swit = 0x2F5F;
// 視LAG情況調整
const moveitemwaittime = 0;
// type0 = 直接飛書
// type1 = 飛書裡的符石
// no = 這個是飛書的符石 RECALL是50開始 66結束
// book = book serial
// todo 檢查檔點
function recall(recalltype = 0, no = 0, book = 0) {
if (recalltype == 0) {
player.cast(Spells.Recall);
target.wait();
target.entity(book);
sleep(recalltime);
} else {
player.use(book);
sleep(500);
var gump = Gump.findOrWait(0x59, 2000);
gump.reply(no);
sleep(recalltime);
}
}
function chop() {
var me = client.findObject(player);
var me_terr = client.getTerrainList(me.x, me.y - 1);
// const axe = client.findType(0xF47);
player.use(axe);
target.wait();
var c = parseInt("0x" + me_terr[1].graphic.toString(16).toUpperCase());
target.terrain(me.x, me.y - 1, 0, c);
sleep(chopwaittime);
}
function putlog(ljno=0,ljbook=0) {
player.say('bank');
sleep(500);
for (var i = 0; i < player.backpack.contents.length; i++) {
if (player.backpack.contents[i].graphic == logd) {
player.moveType(logd, player.backpack, bankbagforlog);
sleep(moveitemwaittime);
}
if (player.backpack.contents[i].graphic == amber) {
player.moveType(amber, player.backpack, bankbagforlog);
sleep(moveitemwaittime);
}
if (player.backpack.contents[i].graphic == plant) {
player.moveType(plant, player.backpack, bankbagforlog);
sleep(moveitemwaittime);
}
if (player.backpack.contents[i].graphic == bark) {
player.moveType(bark, player.backpack, bankbagforlog);
sleep(moveitemwaittime);
}
if (player.backpack.contents[i].graphic == fungi) {
player.moveType(fungi, player.backpack, bankbagforlog);
sleep(moveitemwaittime);
}
if (player.backpack.contents[i].graphic == swit) {
player.moveType(swit, player.backpack, bankbagforlog);
sleep(moveitemwaittime);
}
}
recall(1, ljno, ljbook);
}
function checkweight(ljno=0,ljbook=0) {
if (player.weight + plweight > player.weightMax) {
recall(0, 0, bankbook);
putlog(ljno,ljbook);
}
}
function checklog(no=0) {
// 這裡要抓沒木的訊息 如果不行就用journal
if (journal.containsText("not enough wood here to harvest")) {
journal.clear();
return true
}
journal.clear();
}
function nexttree() {
// 這裡用走的太痛苦了 多印幾支書吧...
var me = client.findObject(player);
for (var i = 0; i < rx; i++) {
for (var j = 0; j < ry; j++){
var me = client.findObject(player);
var terr = client.getTerrainList(me.x - i, me.y - j);
for (var k = 0; k < terr.length; k++){
console.log(terr[k].graphic);
if (terr[k].graphic == 3277 || terr[k].graphic == 3280 || terr[k].graphic == 3283 || terr[k].graphic == 3287 || terr[k].graphic == 3289 || terr[k].graphic == 3293 || terr[k].graphic == 3302) {
walktonexttree(terr[k].x, (terr[k].y+1));
}
}
//console.log(terr);
}
}
}
function walktonexttree(x=0, y=0) {
var walkToTargetX = x - me.x;
var walkToTargetY = y - me.y;
var me = client.findObject(player);
// 這裡x或y要+1 不然會直接踩在身上
while (me.x != x) {
if (walkToTargetX > 0) {
player.walk(Directions.East);
} else {
player.walk(Directions.West);
}
var me = client.findObject(player);
}
while (me.y != y) {
if (walkToTargetY > 0) {
player.walk(Directions.South);
} else {
player.walk(Directions.North);
}
var me = client.findObject(player);
}
}
// main start
var ljbook = eval('ljbook' + startljbook);
journal.clear();
checkweight(ljno,ljbook);
recall(1, ljno, ljbook);
while (true) {
// goto bank and check log for player bag
chop();
checkweight(ljno,ljbook);
var cklog = checklog();
if (cklog === true) {
// ljno符文書的1-16號符石 startljbook符文書1-5本 startljbookno是一開始設定最多幾本
// 會這麼搞是因為私服的樹重生太慢了 只好印5本一直砍等重生
if (ljno > 66) {
ljno = 50;
startljbook = startljbook + 1;
if (startljbook > startljbookno) {
startljbook = 1;
}
var ljbook = eval('ljbook' + startljbook);
} else {
ljno = ljno + 1;
}
// console.log(ljbook);
recall(1, ljno, ljbook);
// nexttree();
}
}
// main end
挖礦 – web
// 以下需要修改的
// 家或銀行的符石書
const bankbook = 0x4032FF9C;
// 家或銀行放鏟子的袋子的ID
const bankbagforore = 0x402A5FBF;
// 16個礦點符石書的ID 在官網挖16點的礦完 第1點就重生
const mnbook = 0x40197792;
// 不用改
var mnno = 50;
// 放鐵錠的袋子
const ingotbag = 0x4017D6EC;
// 以下不要改
// 大礦 類型
const ore1 = 0x19B9;
// 中礦
const ore2 = 0x19B7;
// 小礦
const ore3 = 0x19BA;
// 小小礦
const ore4 = 0x19B8;
// 寶石
const tur = 0x3193;
const eme = 0x3194;
const rub = 0x3197;
const dia = 0x3198;
const cit = 0x3195;
const sap = 0x3192;
// 小黑石
const bbr = 0xF28;
const ingot = 0x1BF2;
const ingotamount = 100;
const shovel = 0xF39;
const toolkit = 0x1EB8;
var toolkitcount = 0;
var shovelcount = 0;
const bank = client.findItemOnLayer(player, Layers.Bank);
const ingotinbag = 100;
const plweight = 100;
const recalltime = 4000;
const moveitemwaittime = 30;
var pbc = player.backpack.contents;
// 這個包要週邊範圍只有一個 不然就要指定ID 可以抓到bank了
// const home_backpack = client.findType(0xE79);
// 每次用for太煩乾脆做一個函數
function findbag(itemtype=0) {
}
function checkingot() {
for (var i = 0; i < pbc.length; i++) {
if (pbc[i].graphic == ingot) {
if (pbc[i].amount < ingotamount) {
player.moveType(ingot, ingotbag, player.backpack, 0, 0, 0, 0, (ingotamount - pbc[i].amount));
}
}
}
}
function checkshovel() {
var shovelcount = 0;
for (var i = 0; i < pbc.length; i++) {
if (pbc[i].graphic == shovel) {
shovelcount = shovelcount + 1;
}
}
if (shovelcount <= 1) {
checktinktool();
makeshovel();
}
}
function makeshovel() {
checktinktool();
for (var i = 0; i < pbc.length; i++) {
if (pbc[i].graphic == toolkit) {
var toolkitid = pbc[i].serial;
}
}
player.use(toolkitid);
// sleep(1000);
var gump = Gump.findOrWait(0x38920ABD, 5000);
//tink tool=23 shovel=72
gump.reply(72);
sleep(1500);
gump.close();
sleep(2000);
}
function checktinktool() {
var toolkitcount = 0;
for (var i = 0; i < pbc.length; i++) {
if (pbc[i].graphic == toolkit) {
toolkitcount = toolkitcount + 1;
}
}
if (toolkitcount <= 1) {
maketinktool();
}
}
function maketinktool() {
for (var i = 0; i < pbc.length; i++) {
if (pbc[i].graphic == toolkit) {
var toolkitid = pbc[i].serial;
}
}
player.use(toolkitid);
sleep(1000);
var gump = Gump.findOrWait(0x38920ABD, 5000);
//tink tool=23 shovel=72
gump.reply(23);
sleep(1500);
gump.close();
sleep(2000);
}
function recall(recalltype = 0, no = 0, book = 0) {
if (recalltype == 0) {
player.cast(Spells.Recall);
target.wait();
target.entity(book);
sleep(recalltime);
} else {
player.use(book);
sleep(500);
var gump = Gump.findOrWait(0x59, 5000);
gump.reply(no);
sleep(recalltime);
}
}
function checkweight(mnno=0,mnbook=0) {
if (player.weight + plweight > player.weightMax) {
recall(0, 0, bankbook);
putmine(mnno,mnbook);
}
}
function check_coordinates(x=0, y=0) {
var me = client.findObject(player);
if (me.x == x || me.y == y) {
return true;
} else {
return false;
}
}
function putmine(mnno=0,mnbook=0) {
player.say('bank');
sleep(500);
var pbc = player.backpack.contents;
for (var i = 0; i < player.backpack.contents.length; i++) {
if (pbc[i].graphic == ore1) {
var ore1id = pbc[i].serial;
// player.moveType(ore1, player.backpack, bankbagforore);
player.moveItem(ore1id, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == ore2) {
player.moveType(ore2, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == ore3) {
player.moveType(ore3, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == ore4) {
player.moveType(ore4, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == tur) {
player.moveType(tur, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == eme) {
player.moveType(eme, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == rub) {
player.moveType(rub, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == dia) {
player.moveType(dia, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == cit) {
player.moveType(cit, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == sap) {
player.moveType(sap, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
if (pbc[i].graphic == bbr) {
player.moveType(bbr, player.backpack, bankbagforore);
sleep(moveitemwaittime);
}
}
checkingot();
sleep(800);
recall(1, mnno, mnbook);
}
function checkore(no=0) {
// 這裡要抓沒礦的訊息 如果不行就用journal
if (journal.containsText("There is no metal here to mine")) {
journal.clear();
return true
}
journal.clear();
}
function dig() {
for (var i = 0; i < pbc.length; i++) {
if (pbc[i].graphic == shovel) {
var shovelid = player.backpack.contents[i].serial;
}
}
player.use(shovelid);
target.wait();
target.terrain(player.x - 1, player.y, 0);
sleep(500);
// todo 這裡要判斷一下 這個點到底礦在哪個方向
// 這裡要抓沒礦的訊息 如果不行就用journal
//console.log(journal.containsText("There is no metal here to mine"));
//journal.clear();
}
// main start
checkweight();
checkshovel();
recall(1, mnno, mnbook);
while (true) {
checkweight();
checkshovel();
dig();
checkweight(mnno, mnbook);
var cklog = checkore();
if (cklog === true) {
if (mnno > 66) {
mnno = 50;
} else {
mnno = mnno + 1;
}
recall(1, mnno, mnbook);
}
// console.log(cklog);
}
// main end
// todo 伺服器存檔時 會卡在讀不在GUMP
// 把Gump.findOrWait調5000看看
// 鐵錠不會堆疊
// recall擋點
gump test
player.use(0x40330ABA);
var gump = Gump.findOrWait(0x59);
//gump?.setTextEntry(0x01, "Hello there");
sleep(1000);
gump.switchPage(2);
sleep(1000);
var gump = Gump.findOrWait(0x59);
sleep(1000);
gump.reply(52); //80,90 empty 50 recall 100 gate 200 remove 300 set default
挖礦
const ore = 0x19b9;
const shovel = client.findType(0xF39);
const bank = client.findItemOnLayer(player, Layers.Bank);
// 以下需要修改的
// 家或銀行的符石書
const homeRune = 0x401BF55C;
// 家或銀行放鏟子的袋子的ID
const homeBag = '';
// 16個礦點符石書的ID 找不到CLICK的功能 因此只能1本書當1顆符石用 在官網挖16點的礦完 第1點就重生
const oreBook = [
0x40110BB1, // 1
0x40110D71 // 2
];
// 這個包要週邊範圍只有一個 不然就要指定ID 可以抓到bank了
// const home_backpack = client.findType(0xE79);
while (true) {
for (var i = 1; i++; oreBook.length) {
player.cast(Spells.Recall);
target.wait();
target.entity(oreBook[i]);
// recall 後 判斷擋點
var me = client.findObject(player);
if (check_coordinates(me.x, me.y)) {
console.log('檔點');
// 隱身休息 12秒後再試 12秒是隱身CD時間
sleep(1000);
}
}
}
function check_weight() {
if ((player.weightMax - 20) > player.weight) {
// back to home or bank
player.cast(Spells.Recall);
target.wait();
target.entity(homeRune);
sleep(2000);
player.say("bank");
sleep(500);
// 還有小礦石要加入
player.moveType(ore, player.backpack, bank);
sleep(500);
}
}
function check_coordinates(x=0, y=0) {
var me = client.findObject(player);
if (me.x == x || me.y == y) {
return true;
} else {
return false;
}
}
function mine() {
var me = client.findObject(player);
var me_terr = client.getTerrainList(me.x, me.y - 1);
player.use(shovel);
target.wait();
// var c = parseInt("0x" + me_terr[1].graphic.toString(16).toUpperCase());
// 這裡要判斷一下 這個點到底礦在哪個方向
target.terrain(me.x, me.y - 1, 0);
// 這裡要抓沒礦的訊息 如果不行就用journal
console.log(journal.containsText("There is no metal here to mine"));
journal.clear();
}
function walk_coordinates(x = 0, y = 0) {
var walkToTargetX = x - me.x;
var walkToTargetY = y - me.y;
var me = client.findObject(player);
// 這裡x或y要+1 不然會直接踩在身上
while (me.x != x) {
if (walkToTargetX > 0) {
player.walk(Directions.East);
} else {
player.walk(Directions.West);
}
var me = client.findObject(player);
}
while (me.y != y) {
if (walkToTargetY > 0) {
player.walk(Directions.South);
} else {
player.walk(Directions.North);
}
var me = client.findObject(player);
}
}
移除陷阱 – python
#Created by Pacho for Heritage server (ServUO).
# Increase this to see the gump getting solved, will make the puzzle time longer
visual_delay = 1
# Lower this if you have a good connection.
# Will make the logs spam more with the message telling you to wait before using another skill
timeout_delay = 4000
####################################
# Data gathered during testing:
# Puzzle size 3
# From 51 to 65.7
# 480 runs
# 928 fails
# 1.93 avg fails/run
# 0.03 avg skillgain/run
# ~36 seconds avg puzzle time
#
# Puzzle size 3
# From 65.7 to 75
# 393 runs
# 758 fails
# 1.92 avg fails/run
# 0.023 avg skillgain/run
# ~36 seconds avg puzzle time
#
# Data lost from 75 to 75.8
#
# Puzzle size 3 & 4 (size 4 at 80 skill and up)
# From 75.8 to 82.3
# 442 runs
# 1247 fails
# 2.82 avg fails/run
# 0.0014 avg skillgain/run
# ~52 seconds avg puzzle time
#
# Puzzle size 4
# From 82.3 to 82.8
# 57 runs
# 269 fails
# 4.72 avg fails/run
# 0.0087 avg skillgain/run
# ~72 seconds avg puzzle time
###############################
from datetime import datetime
trap_box = Target.PromptTarget("Target a circuit trap training kit in your inventory")
initial_skill = Player.GetRealSkillValue("Remove Trap")
box_gump = 653724266
up = 1
right = 2
down = 3
left = 4
messages = {
"success":"You successfully disarm the trap!",
"fail":"You fail to disarm the trap and reset it",
"wait":"You must wait a few moments to use another skill"
}
run_data = {
"coords": [0,0],
"used_coords": [[0,0]],
"size": 3,
"good_steps": [],
"incoming_dir": left,
"last_dir": up,
"successive_fails": 0,
"time_started":datetime.now()
}
fails = 0
runs = 1
avg_reset_time = 0
last_puzzle_time = 0
# Resets the system
def reset(data):
data["coords"] = [0,0]
data["used_coords"] = [[0,0]]
data["size"] = 3
data["good_steps"] = []
data["incoming_dir"] = left
data["last_dir"] = up
data["successive_fails"] = 0
data["time_started"] = datetime.now()
if Gumps.HasGump():
Gumps.CloseGump(box_gump)
# Get the next dir
def getNextDir(last_dir, incoming_dir, cur_coords, used_coords, size, cycle=0):
# Prevents recursion from happening too much. It shouldn't recalculate enough to go around
if cycle > 3:
Misc.SendMessage("Recursion too deep! Aborting recalculation...", 0x80)
return last_dir
next_dir = (last_dir)%4 + 1
if (next_dir == incoming_dir) or (next_dir == left and cur_coords[0] == 0) or (next_dir == up and cur_coords[1] == 0) or (next_dir == right and cur_coords[0] == (size-1)) or (next_dir == down and cur_coords[1] == (size-1)):
next_dir = getNextDir(next_dir, incoming_dir, cur_coords, used_coords, size, cycle + 1)
displacement = getDisplacement(next_dir)
new_coords = [cur_coords[0] + displacement[0], cur_coords[1] + displacement[1]]
coords_traveled = False
for coord in used_coords:
if coord[0] == new_coords[0] and coord[1] == new_coords[1]:
coords_traveled = True
break
if coords_traveled:
next_dir = getNextDir(next_dir, incoming_dir, cur_coords, used_coords, size, cycle + 1)
if (cur_coords[0] == (size-1) and next_dir == up) or (cur_coords[1] == (size-1)and next_dir == left) or (cur_coords[0] == 0 and next_dir == left) or (cur_coords[1] == 0 and next_dir == up):
#Misc.SendMessage("Wrong way: " + dirStr(next_dir) + " Size: " + str(size) + " Coords: " + str(cur_coords), 0x80)
next_dir = getNextDir(next_dir, incoming_dir, cur_coords, used_coords, size, cycle + 1)
return next_dir
def getDisplacement(dir):
if dir == up:
return [0, -1]
elif dir == right:
return [1, 0]
elif dir == down:
return [0, 1]
elif dir == left:
return [-1, 0]
else:
return [0, 0]
def getReverseDir(dir):
if dir == up:
return down
elif dir == right:
return left
elif dir == down:
return up
elif dir == left:
return right
def dirStr(dir):
if dir == up:
return "up"
elif dir == right:
return "right"
elif dir == down:
return "down"
elif dir == left:
return "left"
else:
return "unknown: " + str(dir)
###
def expMovingAvg(new_val, cur_avg, n):
return (new_val - cur_avg)*(2/float(n+1))+cur_avg
###
#Actual program
reset(run_data)
Journal.Clear()
while Player.GetRealSkillValue("Remove Trap") < Player.GetSkillCap("Remove Trap"):
Target.Cancel()
gains = Player.GetRealSkillValue("Remove Trap") - initial_skill
Misc.SendMessage("Skill: " + str(Player.GetRealSkillValue("Remove Trap")) + " Skillgain since start: " + str(gains), 0x60)
Misc.SendMessage("Runs: " + str(runs) + " Fails: " + str(fails), 0x80)
Misc.SendMessage(" Avg fails/run: " + str((0.0+fails)/runs), 0x80)
Misc.SendMessage(" Avg skillgain/run: " + str(gains/runs), 0x80)
Misc.SendMessage(" Avg puzzle time: " + str(avg_reset_time), 0x80)
Player.UseSkill("Remove Trap")
Target.WaitForTarget(timeout_delay, False)
while Journal.Search(messages["wait"]):
Journal.Clear()
Player.UseSkill("Remove Trap")
Misc.Pause(visual_delay)
Target.WaitForTarget(timeout_delay, False)
Target.TargetExecute(trap_box)
Gumps.WaitForGump(box_gump, timeout_delay)
Misc.Pause(visual_delay)
Journal.Clear()
if not Gumps.HasGump():
Target.Cancel()
continue
gump_data = Gumps.LastGumpRawData()
# Count of grey points that are possible to traverse. Used to get the board size instead of a skill level
midpoint_count = gump_data.count("9720")
# 3x3 has 7 midpoints
if midpoint_count == 7:
run_data["size"] = 3
else:
run_data["size"] = 4
if run_data["size"] == 0:
Misc.SendMessage("Puzzle size indeterminate, stopping script", 0x110)
break
Misc.SendMessage("Puzzle Size: " + str(run_data["size"]), 0x60)
# Executes all known good steps for this box run
Misc.SendMessage("Executing known steps: " + str(map(lambda x : dirStr(x), run_data["good_steps"])), 0x80)
Misc.SendMessage("Used coords: " + str(run_data["used_coords"]), 0x80)
for step in run_data["good_steps"]:
Gumps.SendAction(box_gump, step)
Gumps.WaitForGump(box_gump, timeout_delay)
Misc.Pause(visual_delay)
while not (Journal.Search(messages["success"]) or Journal.Search(messages["fail"])):
run_data["next_dir"] = getNextDir(run_data["last_dir"], run_data["incoming_dir"], run_data["coords"], run_data["used_coords"], run_data["size"])
Misc.SendMessage("Trying " + dirStr(run_data["next_dir"]) + ", previous try " + dirStr(run_data["last_dir"]) + ", came from " + dirStr(run_data["incoming_dir"]), 0x49)
Gumps.SendAction(box_gump, run_data["next_dir"])
Gumps.WaitForGump(box_gump, timeout_delay)
run_data["last_dir"] = run_data["next_dir"]
if Gumps.HasGump():
displacement = getDisplacement(run_data["last_dir"])
run_data["coords"] = [run_data["coords"][0] + displacement[0],run_data["coords"][1] + displacement[1]]
run_data["good_steps"].append(run_data["last_dir"])
run_data["used_coords"].append([run_data["coords"][0], run_data["coords"][1]])
run_data["incoming_dir"] = getReverseDir(run_data["last_dir"])
run_data["successive_fails"] = 0
Misc.Pause(visual_delay)
else:
break
if Journal.Search(messages["success"]):
Misc.SendMessage("Succeeded", 0x39)
runs = runs + 1
last_puzzle_time = datetime.now() - run_data["time_started"]
avg_reset_time = expMovingAvg(last_puzzle_time.total_seconds(), avg_reset_time, runs-1)
Misc.SendMessage("Solve time: " + str(last_puzzle_time), 0x39)
reset(run_data)
elif Journal.Search(messages["fail"]):
Misc.SendMessage("Failed", 0x39)
run_data["successive_fails"] = run_data["successive_fails"]+1
fails = fails + 1
if run_data["successive_fails"] > 3:
Misc.SendMessage("Too many successive fails, resetting...", 0x80)
if Gumps.HasGump():
Gumps.CloseGump(box_gump)
reset(run_data)
else:
Misc.SendMessage("Timed out", 0x39)
Misc.SendMessage("Training complete!", 0x90)
包包拉東西 – euo
IF %NOTSTART = N/A
{
;點選垃圾筒
try_again:
EVENT SYSMESSAGE SOURCE_BAG
wait 2
set #targcurs 1
target 20s
waittarget1:
if #targcurs = 0
{
SET %box1 #LTARGETID
Set #LOBJECTID #LTARGETID
event macro 17 0
wait 20
contpos 10 10
EVENT SYSMESSAGE %box1
}
if %box1 = n/a
goto waittarget1
EVENT SYSMESSAGE TARGET_BAG
wait 2
set #targcurs 1
target 20s
waittarget2:
if #targcurs = 0
{
SET %box2 #LTARGETID
Set #LOBJECTID #LTARGETID
event macro 17 0
wait 20
contpos 250 10
EVENT SYSMESSAGE %box2
}
if %box2 = n/a
goto waittarget2
EVENT SYSMESSAGE ITEM
wait 2
set #targcurs 1
target 20s
waittarget3:
if #targcurs = 0
{
SET %itema #LTARGETID
FINDITEM %itema C_ , %box1
IF #FINDKIND = 0
{
EXEVENT DRAG #FINDID #FINDSTACK
EXEVENT DROPC %box2
WAIT 20
SET %item #FINDTYPE
IGNOREITEM #FINDID
EVENT SYSMESSAGE %item
}
}
if %item = n/a
goto waittarget3
}
SET %NOTSTART = True
DROP:
FINDITEM %item C_ , %box1
;0 表示在包包 1表示在地上 -1表示沒找到
IF #FINDKIND = 0
{
EXEVENT DRAG #FINDID #FINDSTACK
EXEVENT DROPC %box2
WAIT 20
IGNOREITEM #FINDID
goto DROP
}
ELSE
{
EVENT SYSMESSAGE DONE.
halt
}
跟隨 – web
function walk_coordinates(x = 0, y = 0) {
var walkToTargetX = x - me.x;
var walkToTargetY = y - me.y;
var me = client.findObject(player);
// 這裡x或y要+1 不然會直接踩在身上
while (me.x != x) {
if (walkToTargetX > 0) {
player.walk(Directions.East);
} else {
player.walk(Directions.West);
}
var me = client.findObject(player);
}
while (me.y != y) {
if (walkToTargetY > 0) {
player.walk(Directions.South);
} else {
player.walk(Directions.North);
}
var me = client.findObject(player);
}
}