|
Raver2222 Beginner
Joined: 18 Oct 2002 Posts: 18 Location: Poland
|
Posted: Thu Jul 10, 2003 2:19 pm
herb colecting bot problem |
#VAR herbpath {e|e|s|s|w|se|se|w|se|w|ne}
#AL herbboton {#T+ herbboton;#VAR step 1;#VAR command 0}
#CLASS herbboton disable
#AL move {#IF (@step > 10) {alias} {#IF (@step > %numitems(@herbpath)) {#T- herbboton} {%item(@herbpath, @step);#ADD step 1;command}}}
#TR {text1} {#IF (@sz > 0) {#VAR command 0;move} {#VAR command 1;command}}
#TR {text2} {move}
#CLASS 0
#AL herbbotoff {#T- herbboton}
my script looks like that
1.my bot goes by herbpath
2.in every location it does `command` and waits for result
3.if result is positive it makes `command` again and goes to the next location
4.if negative, it goes to the next location
5.after 10 locations PROBLEM starts
it makes alias, and makes it after every `command`
it doesn`t want to walk to the next location just doing `command` and `alias` all the time
HELP to solve this problem
i want it to do every 1234 pionts wchich are corect, after 10 locations it should do `alias` once and go next 10 locations normally without doing `alias`,`alias`, 10 locations, `alias` ,and so on...
HELP |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Jul 10, 2003 5:07 pm |
It seems to be doing exactly what you told it to do.
#AL move {#IF (@step > 10) {alias} {#IF (@step > %numitems(@herbpath)) {#T- herbboton} {%item(@herbpath, @step);#ADD step 1;command}}}
If you want it to do something different, change the #IF condition to match what you want. In this case, it sounds like you want to test for @step is evenly divisible by 10 (no remainder). For that, you'd use modulus division either with the %mod function or the backslash (which the forum apparently no longer accepts).
#AL move {#IF (%mod( @step, 10) = 0) {alias} {#IF (@step > %numitems(@herbpath)) {#T- herbboton} {%item(@herbpath, @step);#ADD step 1;command}}}
Without the entire script ('alias' and 'command' in particular), that's all the help I can give. |
|
|
|
Raver2222 Beginner
Joined: 18 Oct 2002 Posts: 18 Location: Poland
|
Posted: Thu Jul 10, 2003 6:05 pm |
after changes log looks like that:
herbboton
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command
text1
command....
and so on
i want it look like that
herbboton
command
text1
command
e
command
text1
command
text1
e
[few thimes more]
[10th location]
w
command or command
text1 text2
command alias
text1 ne
alias
ne
if you can help just help |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Jul 10, 2003 9:18 pm |
If you aren't willing to supply the real script and mud output instead of things like 'command', 'text1', 'alias', etc, it's doubtful that anyone will be able to help.
I suggested only one change to your script. The only difference the change I suggested would make is that you would do 'alias' when @step is a multiple of 10 instead of when it's greater than 10. That's what you said you wanted. I'm sorry it doesn't work for you. You might investigate @sz (another mystery script component). |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jul 11, 2003 5:07 pm |
Okay, I went back to the original topic and got the script (as much as I could, anyway). I thought this looked familiar...
#VAR herbpath {se|e|e|e|n|n|ne|e}
#AL herbs {#T+ herbs;#VAR step 1;#VAR sz 0}
#CLASS herbs disable
#AL move {#IF (@step > 10) {3} {#IF (@step > %numitems(@herbpath)) {#T- herbs} {%item(@herbpath, @step);#ADD step 1;sz}}}
#TR {^Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}}
#TR {Szukasz wszedzie, ale nie znajdujesz zadnych ziol.} {move}
#TR {Nie znajdujesz zadnych ziol.} {move}
#CLASS 0
#AL herbbotoff {#T- herbs}
I now know that 'alias' is '3', but still don't know what it actually does (and might not need to know). I also know that 'command' is 'sz' which is the command to search. 'Text 1' is 'Znajdujesz ' at the beginning of the line. 'Text 2' is 'nie znajdujesz zadnych ziol.'
The 'herbboton' alias should probably have 'sz' at the end of it. After doing the 'alias' (3), it's necessary to take a step, add to the step counter, and search. I noticed that you changed the starting alias and class from 'herbs' to 'herbboton'.
Revised script:
#VAR herbpath {e|e|s|s|w|se|se|w|se|w|ne}
#AL herbboton {#T+ herbboton;#VAR step 1;#VAR sz 0;sz}
#CLASS herbboton disable
#AL move {#IF (%mod( @step, 10) = 0) {3;%item( @herbpath, @step);#ADD step 1;sz} {#IF (@step > %numitems(@herbpath)) {#T- herbboton} {%item( @herbpath, @step);#ADD step 1;sz}}}
#TR {^Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}}
#TR {nie znajdujesz zadnych ziol.} {move}
#CLASS 0
#AL herbbotoff {#T- herbboton}
You should only need to make changes to the settings marked with red, the 'herbboton' and 'move' aliases. |
|
|
|
Raver2222 Beginner
Joined: 18 Oct 2002 Posts: 18 Location: Poland
|
Posted: Fri Jul 11, 2003 10:20 pm |
Hey LigtBulb i can`t belive it WORKS. You must be kind of a genius i think. Thanks a lot. If there will be any problem i will ask so beware ;) Thanks again.
PEACE |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|