Traduction C# --> autoit

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Répondre
wiwileborne
Niveau 1
Niveau 1
Messages : 9
Enregistré le : lun. 12 déc. 2016 13:44
Status : Hors ligne

Traduction C# --> autoit

#1

Message par wiwileborne »

HEY Salut tout le monde ! Je voulait savoir si vous pouvez m'aider a traduire se code c# en autoit :P
public int X
         {
             get
             {
                 m_x = (Id & 0x3FE00) >> 9; // 9 higher bits
                 if ((m_x & 0x100) == 0x100) // 9th bit is the sign. 1 means it's minus
                 {
                     m_x = -(X & 0xFF); // just take the 8 first bits and take the opposite number
                 }
                 return m_x.Value;
             }
         }
 
        public int Y
         {
             get
             {
                 m_y = Id & 0x01FF; // 9 lower bits
                 if ((m_y & 0x100) == 0x100) // 9th bit is the sign. 1 means it's minus
                 {
                     m_y = -(X & 0xFF); // just take the 8 first bits and take the opposite number
                 }
                 return m_y.Value;
             }
         }
Avatar du membre
orax
Modérateur
Modérateur
Messages : 1479
Enregistré le : lun. 23 mars 2009 04:50
Localisation : ::1
Status : Hors ligne

Re: Traduction C# --> autoit

#2

Message par orax »

Bienvenue sur le forum.

Un début :
La ligne
m_x = (Id & 0x3FE00) >> 9; // 9 higher bits
correspond à
$m_x = BitShift(BitAND($Id, 0x3FE00), 9)

& correspond à BitAND et >> à BitShift
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
wiwileborne
Niveau 1
Niveau 1
Messages : 9
Enregistré le : lun. 12 déc. 2016 13:44
Status : Hors ligne

Re: Traduction C# --> autoit

#3

Message par wiwileborne »

Hey bon entre temps j'avais fini par trouver avant que vous me répondiez mais merci quand même par contre je bloque sur Y qui ne me renvoi pas la bonne valeur

Y devrait me renvoyer : -16
mais il me renvoi 6 why ?
est se que j'ai pus faire une erreur qqpart ?
#include <MsgBoxConstants.au3>
$Mapid = 84805126
$m_x = 0
X()
Func X()



                $m_x = BitShift(BitAND($Mapid, 0x3FE00), 9)

                if BitAND($m_x, 0x100) == 0x100 Then  ;9th bit is the sign. 1 means its minus

                    $m_x = -BitAND( $m_x,0xFF); // just take the 8 first bits and take the opposite number

Return $m_x
            EndIf


EndFunc


$m_y = 0
Y()
Func Y()



                $m_y = BitAND($Mapid , 0x01FF); // 9 higher bits

                if BitAND($m_y, 0x100) == 0x100 Then  ;9th bit is the sign. 1 means its minus

                    $m_y = -BitAND( $m_y,0xFF); // just take the 8 first bits and take the opposite number

Return $m_y
            EndIf

EndFunc
MsgBox($MB_SYSTEMMODAL, "Title", $m_x & "   " & $m_y, 10)
wiwileborne
Niveau 1
Niveau 1
Messages : 9
Enregistré le : lun. 12 déc. 2016 13:44
Status : Hors ligne

Re: Traduction C# --> autoit

#4

Message par wiwileborne »

alors personne pour m'aider ?
Répondre