Il affiche constamment "LEFT" même quand il n'est pas dans la même colonne / ligne que la destination
en imaginant que
$POS_COLS=HAUT & BAS
$POS_ROWS=GAUCHE & DROITE
$POS_END_COLS=Destination
$POS_END_ROWS)=Destination
Destination = 5;5
Depart=0;0
En résumé si on est actuellement sur la même colonne ou ligne il affiche une seule direction sinon il affiche les 2 possibles
CODE FONCTIONNEL
Bonne journée
map:
Code : Tout sélectionner
S1111
10101
10101
10101
1111E
Func _OPERATION_GPS($POS_COLS, $POS_ROWS, $POS_END_COLS, $POS_END_ROWS)
Local $GPS
If $POS_COLS < $POS_END_COLS Then
$GPS &= "DOWN" ;Down
Else
$GPS &= "UP" ;Up
EndIf
If $POS_ROWS < $POS_END_ROWS Then
$GPS &= "RIGHT" ;Right
Else
$GPS &= "LEFT" ;Left
EndIf
If $POS_COLS = $POS_END_COLS And $POS_ROWS < $POS_END_ROWS Then
$GPS = "DOWN" ;Down
ElseIf $POS_COLS = $POS_END_COLS And $POS_ROWS > $POS_END_ROWS Then
$GPS = "UP" ;Up
EndIf
If $POS_ROWS = $POS_END_ROWS And $POS_COLS < $POS_END_COLS Then
$GPS = "RIGHT" ;Right
ElseIf $POS_ROWS = $POS_END_ROWS And $POS_COLS > $POS_END_COLS Then
$GPS = "LEFT" ;Left
EndIf
If $POS_COLS = $POS_END_COLS And $POS_ROWS = $POS_END_ROWS Then
Consolewrite("DESTINATION" & @CRLF)
$GPS = "DESTINATION" ;DESTINATION
Else
EndIf
$SIM_GPS_ACTUAL = $GPS
Return $GPS
EndFunc ;==>_OPERATION_GPS
Local $GPS
If $POS_COLS < $POS_END_COLS Then
$GPS &= "DOWN" ;Down
Else
$GPS &= "UP" ;Up
EndIf
If $POS_ROWS < $POS_END_ROWS Then
$GPS &= "RIGHT" ;Right
Else
$GPS &= "LEFT" ;Left
EndIf
If $POS_COLS = $POS_END_COLS And $POS_ROWS < $POS_END_ROWS Then
$GPS = "DOWN" ;Down
ElseIf $POS_COLS = $POS_END_COLS And $POS_ROWS > $POS_END_ROWS Then
$GPS = "UP" ;Up
EndIf
If $POS_ROWS = $POS_END_ROWS And $POS_COLS < $POS_END_COLS Then
$GPS = "RIGHT" ;Right
ElseIf $POS_ROWS = $POS_END_ROWS And $POS_COLS > $POS_END_COLS Then
$GPS = "LEFT" ;Left
EndIf
If $POS_COLS = $POS_END_COLS And $POS_ROWS = $POS_END_ROWS Then
Consolewrite("DESTINATION" & @CRLF)
$GPS = "DESTINATION" ;DESTINATION
Else
EndIf
$SIM_GPS_ACTUAL = $GPS
Return $GPS
EndFunc ;==>_OPERATION_GPS