Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can someone fix my code?
08-17-2016, 01:02 PM (This post was last modified: 08-17-2016 01:02 PM by lotherad.)
Post: #1
Can someone fix my code?
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.
Give Reputation to this user
Find all posts by this user
Quote this message in a reply
08-17-2016, 04:20 PM (This post was last modified: 01-13-2017 10:11 PM by Catar.)
Post: #2
RE: Can someone fix my code?
(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

rngvialdrop (auto: 5000ms)
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()



It drops +/- 2 sqm from you
Give Reputation to this user

Before you PM me, READ THIS [Image: KHCf9l2.png]

[Image: naLmyGH.png]

My Scripts, Macros and Tutorials
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)