Posts: 76
Threads: 19
Joined: Aug 2014
Reputation:
0
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()
If it helped give the REP+
If someone is offended SORRY
Posts: 3,907
Threads: 340
Joined: Feb 2012
Reputation:
0
Else is not valid, you should try this:
1>2 [ElseLabel1]
DoSomethingWhen1Bigger2
{ElseLabel1}
Obviously1IsNotBiggerThan2Man!
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
05-23-2017, 04:26 PM
(This post was last modified: 05-23-2017, 04:26 PM by Catar.)
what are you trying to do anyway? because from what i see, it looks useless ;D
Posts: 76
Threads: 19
Joined: Aug 2014
Reputation:
0
05-23-2017, 04:50 PM
(This post was last modified: 05-23-2017, 04:51 PM by lukasze.)
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
If it helped give the REP+
If someone is offended SORRY
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
05-23-2017, 05:24 PM
(This post was last modified: 05-23-2017, 11:10 PM by Catar.)
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
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()
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
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()
[/spoiler]
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
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()
[/spoiler]
In single run of this macro, it checks every position in 1sqm radius from the character, including underneath.
loop with exit
Posts: 76
Threads: 19
Joined: Aug 2014
Reputation:
0
thx for this simple* macro
If it helped give the REP+
If someone is offended SORRY
Posts: 1,630
Threads: 103
Joined: Sep 2015
Reputation:
0
(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?
Posts: 3,907
Threads: 340
Joined: Feb 2012
Reputation:
0
(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.
|