Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Yegg on December 13, 2004, 06:42 PM

Title: [Python] MakeLong
Post by: Yegg on December 13, 2004, 06:42 PM
Ok, I need a little help with putting MakeLong in python. I'm assuming it is something like GetDWORD and GetWORD.

    def MakeDWORD(n):
        return struct.pack("< I", n)


Banana fanna fo fanna showed me this code and helped me with it. I'm guessing that since both MakeLong and MakeWORD/DWORD use CopyMemory in VB6 that in Python they would both use the struct module. For MakeLong I have,

    def MakeLong(x):
        if len(x) < 4:
            pass
        return struct.pack("< L", x)


My problem is that I'm not sure if I use L for unsigned long or if I use something else. And this probably isn't the only problem.
Title: Re: [Python] MakeLong
Post by: Zakath on December 14, 2004, 02:21 AM
Why are you making a long when you already have a DWORD?

DWORD is the exact same thing as an unsigned long.
Title: Re: [Python] MakeLong
Post by: Yegg on December 14, 2004, 02:07 PM
Umm, Oh, thanks.
Title: Re: [Python] MakeLong
Post by: Banana fanna fo fanna on December 14, 2004, 02:27 PM
Yegg, will you please RTFM. I've told you twice already; this is number 3. There's a nice easy table for you to use.
Title: Re: [Python] MakeLong
Post by: BaDDBLooD on December 14, 2004, 08:17 PM
Quote from: Zakath on December 14, 2004, 02:21 AM
Why are you making a long when you already have a DWORD?

DWORD is the exact same thing as an unsigned long.

The reason why, is because he uses code that uses the "MakeLong" function, as well as the "Make DWORD", not knowing they are the same thing.  IMHO