Posts: 6
Threads: 2
Joined: Nov 2013
Reputation:
0
11-22-2013, 01:17 PM
(This post was last modified: 11-22-2013, 01:23 PM by tem0x43.)
I want doing macro fallow lider. Still a lot of work to do. My first problem is five line of this code:
ID_LIDER:=Creature.ByName(NAME_LIDER)
ID_MY:=Creature.ByName(NAME_MY)
k:=Creature.X(!ID_LIDER!)
z:=Creature.X(!ID_MY!)
c:=(k-z)
Self.Say(!c!)
Here I want obtain different position. When i have there i can use if-function.
For example: if (c>=2) Self.MoveE
if(c<=2) Self.MoveW.
Now function Self.Say(!c!) always return 0, function c:=(k-z) have wrong form.
My second problem is correct form function if() in BBot.
c:=(!k!-!z!) is too wrong form.
Posts: 6
Threads: 2
Joined: Nov 2013
Reputation:
0
11-22-2013, 02:23 PM
(This post was last modified: 11-22-2013, 06:32 PM by tem0x43.)
I play on OTS. I have two character online in the same time. I need to my one character follow my second character. Function Creature.Follow() don't work, so i want do this other way.
If c =1 or c=-1, that mean character one is next to character two (don't work anything).
If c>=2 or c<=2 that mean character which must go follow is too far followed character (then he must go step East or West).
c=0 only when both in the same place (impossible, when i going on one level)
Now i doing only X-position (East, West).
Posts: 6
Threads: 2
Joined: Nov 2013
Reputation:
0
11-22-2013, 07:05 PM
(This post was last modified: 11-22-2013, 07:06 PM by tem0x43.)
Yes ID monster and player is 99 and which i get by using Creature.ByName return own ID. But i want know only why dosn't work c:=(k-z). Why don't return: ...-2..-1..0..1.2..., and always return 0?
Posts: 142
Threads: 13
Joined: Apr 2013
(11-22-2013, 07:05 PM)tem0x43 Wrote: Yes ID monster and player is 99 and which i get by using Creature.ByName return own ID. But i want know only why dosn't work c:=(k-z). Why don't return: ...-2..-1..0..1.2..., and always return 0?
becouse if you want to make any mathematical operations you need to use :
Code:
VarAdd(Name, Value) Increase the variable value by a given value
Inc(Name, Value) Increase the variable value by a given value
VarSub(Name, Value) Decrease the variable value by a given value
Dec(Name, Value) Decrease the variable value by a given value
VarMult(Name, Value) Multiplies the variable value by the given value
Mult(Name, Value) Multiplies the variable value by the given value
VarDiv(Name, Value) Divides the variable value by the given value
Div(Name, Value) Divides the variable value by the given value
VarMod(Name, Value) Returns the modulos remainder of the Variable by the Value
Mod(Name, Value) Returns the modulos remainder of the Variable by the Value
Posts: 6
Threads: 2
Joined: Nov 2013
Reputation:
0
Can you impement this in my code?