Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can someone fix my code?
#1
I'm trying to write the code to throw empty vials at random squares, map looks like this (x - can't throw there, o - able to throw, c - character):

xooooo
ooooco

So basicly I can throw max 4 sqm to the left and 1 to the right, 1 to the up and 1 down so I tried to make it random:

Code:
X:=Self.X()
Y:=Self.Y()
Z:=Self.Z()

RX:=Misc.Random(0,4)

if(!RX!==4)
Y:=Self.Y()
else
Dec(Y, 1)

if(!RX!>1) Dec(X, RX)
else Inc(X, RX)

Map.Thrown(285, 100, X, Y, Z)

But Misc.Random() is returnings numbers like 1336611564.

Can someone fix this and my if...else statements? I'm not sure how to do them in BBot.
Reply
#2
(08-17-2016, 01:02 PM)lotherad Wrote: I'm trying to write the code to throw empty vials at random squares, map looks like this (x - can't throw there, o - able to throw, c - character):

xooooo
ooooco

So basicly I can throw max 4 sqm to the left and 1 to the right, 1 to the up and 1 down so I tried to make it random:

Code:
X:=Self.X()
Y:=Self.Y()
Z:=Self.Z()

RX:=Misc.Random(0,4)

if(!RX!==4)
Y:=Self.Y()
else
Dec(Y, 1)

if(!RX!>1) Dec(X, RX)
else Inc(X, RX)

Map.Thrown(285, 100, X, Y, Z)

But Misc.Random() is returnings numbers like 1336611564.

Can someone fix this and my if...else statements? I'm not sure how to do them in BBot.


There are no IFs, elses in bbot macros


check one of my macros (on right under my post) to see how 'conditions' work









Ok made that macro for u...... idk why, guess i was bored

[macro]5000 {rngvialdrop}
vialID:=285
Xd:=Self.X()
Yd:=Self.Y()
Zd:=Self.Z()
Rx:=Misc.Random(0, 4)
Ry:=Misc.Random(0, 4)
VarSub(Rx, 2)
VarSub(Ry, 2)
VarAdd(Xd, !Rx!)
VarAdd(Yd, !Ry!)
Map.Thrown(!vialID!, -1, !Xd!, !Yd!, !Zd!)
Exit()
[/macro]


It drops +/- 2 sqm from you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)