|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Wed Sep 23, 2009 5:39 pm
can you find the bug in my code |
Basically i am pathing to a room checking for the mob then killing it if its there. if its not there return from room.
after i kill it check to see if there are anymore in the room. this room usually has 3 in it but sometimes it has 2.
for some reason when there are only 2 in the room my code doesn't path me back from the room it stays in the room.
i will add in comments to explain the lines.
Quote: |
p Lets go do Druegar Soldier1
#wait 3000
fda //follow ditch all makes my team quit following me
#all .druegarsoldiers1 // makes my whole team walk to the spot.. there are some gates and stuff that close on my team if they don't walk invividually
#wait 3000
look
#waitfor {^A Druegar Soldier.} 3000
{
patall // an alias that pats everyone in my team, they all follow me on being patted.
kill soldier
#waitfor {You receive (%d) experience points.}
look
#waitfor {^A Druegar Soldier.} 3000
{kill soldier
#waitfor {You receive (%d) experience points.}
look
#waitfor {^A Druegar Soldier.} 3000
{kill soldier
#waitfor {You receive (%d) experience points.}}}
fda
#wait 3000
#all ..druegarsoldiers1
#wait 3000
#wait 3000
sellall //alias to sell all items gained
stashcoins //alias to dump some cask in a room
patall //alias to get my team to follow me.
}
{
p Soldier1 is not here.
#all ..druegarsoldiers1
#wait 3000
patall
}
IncrementBot //alias to increment my bot to my next trig. |
|
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Thu Sep 24, 2009 2:31 pm well if there is no bug |
is there a better way to do this checking for mob before attack?
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 24, 2009 7:15 pm |
If you look closely at your code, you will see that your second "#waitfor {^A Druegar Soldier.} 3000" line is within the action clause of the first "#waitfor {^A Druegar Soldier.} 3000" line, and the third "#waitfor {^A Druegar Soldier.} 3000" is within the action clause of the second. Neither the second nor the third has a failure clause. So, if the first druegar line fails, it executes a failure clause, but if the second or third lines fail, it doesn't do anything special. If you want to handle these cases, you will have to add failure clauses like you have for the first line.
As a side note, placing braces at the start of a line can confuse cmud sometimes. It definitely confuses the 'reformat' function, and has been known to confuse the compiler as well. I don't think it's causing a problem here, but I wanted to point it out because I had to reformat your code in order to see the different levels of clauses in your code. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 24, 2009 8:29 pm |
Wait, I take it back. Since there is no failure clause, it should just drop to the path lines. I don't see the problem offhand. Is it possible you are getting interference from a different thread?
|
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Fri Sep 25, 2009 12:23 am |
I don't think i am getting trouble from another thread. since i start the pattern with the ^ that means the line has to begin on a freash line.
do you think it might be the way i have things braceted on new lines? should i delete the new lines and put the bracettes just a space after? |
|
|
|
|
|