![]() |
Help - Printable Version +- BBot - The best bot of the world (https://forums.bmega.net) +-- Forum: Scripts & Macros (https://forums.bmega.net/forum-4.html) +--- Forum: Requests (https://forums.bmega.net/forum-17.html) +--- Thread: Help (/thread-20694.html) |
Help - lukasze - 05-23-2017 what is wrong? X:=Self.X() Y:=Self.Y() Z:=Self.Z() VarSub(Y, 1) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() else VarSub(X, 1) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() else VarAdd(Y, 1) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() else VarAdd(X, 2) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() VarSub(Y, 1) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() else VarAdd(Y, 2) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() else VarSub(X, 1) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() else VarSub(X, 1) Map.HasID(8503, !X!, !Y!, !Z!)==1 Self.Say(Here) Exit() RE: Help - MegaNo0body - 05-23-2017 Else is not valid, you should try this: 1>2 [ElseLabel1] DoSomethingWhen1Bigger2 {ElseLabel1} Obviously1IsNotBiggerThan2Man! RE: Help - Catar - 05-23-2017 what are you trying to do anyway? because from what i see, it looks useless ;D RE: Help - lukasze - 05-23-2017 i want stop cavebot next to Soft Rock [8503] i thing bbot can inspect id on map, so i try use this macro Map.HasID and next X:=Self.X() Y:=Self.Y() Z:=Self.Z() Map.UseOn(3456, 8503, !X!, !Y!, !Z!, 1) Macro.Wait(500) Cavebot.Start() its for OTS archlightonline.com http://archlightonline.wikispaces.com/Mining RE: Help - Catar - 05-23-2017 Edited: There are 3 versions of this macro, and last one, on the bottom, done by BMega is shortest, but most complex. Just remember to use bbot 82.4 or higher for this [macro]100 {stopnear} IDtostop:=8503 V0:=0 Xw:=Sub(:X, 1) Xe:=Add(:X, 1) Yn:=Sub(:Y, 1) Ys:=Add(:Y, 1) v:=Map.HasID(!IDtostop, !Xw, !Yn, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, :X, !Yn, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, !Xe, !Yn, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, !Xe, :Y, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, !Xe, !Ys, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, :X, !Ys, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, !Xw, !Ys, :Z) VarAdd(V0, !v) v:=Map.HasID(!IDtostop, !Xw, :Y, :Z) VarAdd(V0, !v) !V0>=1 Cavebot.Stop() [/macro] Code: IDtostop:=8503 under spoiler was my first version of macro, but then Mega reminded me of even shorter one which is above [spoiler] [macro]100 {stopnear} IDtostop:=8503 Xw:=Sub(:X, 1) Xe:=Add(:X, 1) Yn:=Sub(:Y, 1) Ys:=Add(:Y, 1) v1:=Map.HasID(!IDtostop, !Xw, !Yn, :Z) v2:=Map.HasID(!IDtostop, :X, !Yn, :Z) v3:=Map.HasID(!IDtostop, !Xe, !Yn, :Z) v4:=Map.HasID(!IDtostop, !Xe, :Y, :Z) v5:=Map.HasID(!IDtostop, !Xe, !Ys, :Z) v6:=Map.HasID(!IDtostop, :X, !Ys, :Z) v7:=Map.HasID(!IDtostop, !Xw, !Ys, :Z) v8:=Map.HasID(!IDtostop, !Xw, :Y, :Z) va:=Add(!v1, !v2) vb:=Add(!v3, !v4) vc:=Add(!v5, !v6) vd:=Add(!v7, !v8) vA:=Add(!va, !vb) vB:=Add(!vc, !vd) V0:=Add(!vA, !vB) !V0>=1 Cavebot.Stop() [/macro] Code: IDtostop:=8503 Okay, we had a talk with Mega about even a shorter version of this macro. And what he created it is dope. [macro]100 {stopnear} IDtostop:=8503 Xi:=-1 Yi:=-1 {CheckAgain} X:=Add(:X, !Xi) Y:=Add(:Y, !Yi) Map.HasID(!IDtostop, !X, !Y, :Z)==1 [Continue] Cavebot.Stop() exit() {Continue} VarAdd(Xi, 1) !Xi==2 [CheckAgain] Xi:=-1 VarAdd(Yi, 1) !Yi==2 [CheckAgain] Exit()[/macro] [spoiler] Code: IDtostop:=8503 In single run of this macro, it checks every position in 1sqm radius from the character, including underneath. loop with exit RE: Help - lukasze - 05-24-2017 thx for this simple* macro RE: Help - Catar - 05-24-2017 (05-24-2017, 12:12 AM)lukasze Wrote: thx for this simple* macro Much simpler than your idea? isn't it? My was based on having all these SQM checked and summed up into one variable, Then this wariable was checked. BMega was a kind of loop. But have you tested them? Do they as you work wanted? RE: Help - MegaNo0body - 05-24-2017 (05-23-2017, 05:24 PM)Catar Wrote: Okay, we had a talk with Mega about even a shorter version of this macro. And what he created it is dope. ![]() |