alias findpath {
set %olistitems 0 | set %clistitems 0
set %start.x $1 | set %start.y $2
[color:blue].echo -a $olistadd($1,$2,0,$1,$2)
set %current.x $1 | set %current.y $2 .............................. Your initially setting these but have already refrenced them in the above $identifier [/color]
while (%current.x != %d.x && %current.y != %d.y) {
setcurrent ;;removes from open list :)
.echo -a $clistadd(%current.x,%current.y,%current.g,%current.px,%current.py)
set %a -1 |
while %a <= 1 {
set %b -2
while %b <= 0 {
inc %b
if (%a == 0 && %b == 0) { continue }
if (%a != 0 && %b != 0) { continue }
if $clistexists($calc(%current.x + %a),$calc(%current.y + %b)) == 1 { continue }
if ([color:blue]%diggermap [ $+ [ $calc(%current.x + %a) ] ] [ $+ [ $calc(%current.y + %b) ] ][/color] == enemy || [color:blue]%diggermap [ $+ [ $calc(%current.x + %a) ] ] [ $+ [ $calc(%current.y + %b) ] ][/color] == empty || [color:blue]%diggermap [ $+ [ $calc(%current.x + %a) ] ] [ $+ [ $calc(%current.y + %b) ] ][/color] == digger) {
[color:blue]This is ment to represent a 2 dimentional array, however the location (1,13) makes %diggermap113 and location (11,3) also makes %diggermap113
this could be corrected by using %diggermap [ $+ [ Xn ] $+ ] ~ [ $+ [ Yn ] ] producing %diggermapXn~Yn aka %diggermap1~13 & %diggermap11~3[/color]