Page 1 of 1

Getting maximum and current budgets properly

Posted: Tue Jun 17, 2008 5:53 pm
by Nuklear
I've been having problems getting the correct budget value from an usermap.

Shade45's usermap says it's a floating point number, so I tried to read it, but it's wrong. The numbers are too big to be a budget. I've tried changing it to integer too and same problem.

Does anyone know how to correctly get the budget value or tell me more info about budgets.

Posted: Tue Jun 17, 2008 5:56 pm
by SPARTAN-OMEGA
Shades right, try a bit harder

Posted: Tue Jun 17, 2008 6:23 pm
by Nuklear
I'll try looking at sandbox source again.

Edit, I didn't know there was a ReadSingle method. =P

But, it doesn't get the budgets correctly, just the coordinates.

Why would budget need to be a floating point number when it never have decimal numbers.

Posted: Tue Jun 17, 2008 7:20 pm
by SPARTAN-OMEGA
Im not sure, Ive only found it not edited it

Posted: Tue Jun 17, 2008 10:46 pm
by shade45
Are you reading it in Big Endian because it seems to be correct in every usermap I've seen??

Posted: Tue Jun 17, 2008 11:24 pm
by Patrickssj6
He's probably not since normally it's Small Endian by default.

Posted: Wed Jun 18, 2008 12:53 pm
by Nuklear
shade45 wrote:Are you reading it in Big Endian because it seems to be correct in every usermap I've seen??
I am reading it in Big Endian yes.

Here's my code:

Code: Select all

            PlacementBlock.Block.Maximum_Budget = io.In.ReadSingle(EndianType.BigEndian);
            PlacementBlock.Block.Current_Budget = io.In.ReadSingle(EndianType.BigEndian);
Can you tell me the offset for budgets. Maybe I got it wrong.

Posted: Wed Jun 18, 2008 1:04 pm
by SPARTAN-OMEGA
Ya thats not what I found for budget

Posted: Wed Jun 18, 2008 1:32 pm
by Nuklear
So, can you tell me the offsets for budget from the beginning of _blf please?

Posted: Wed Jun 18, 2008 2:14 pm
by shade45
Yeah,

Maximum Budget is 0x268 and Current Budget is 0x26C.

Posted: Wed Jun 18, 2008 2:41 pm
by Nuklear
shade45 wrote:Yeah,

Maximum Budget is 0x268 and Current Budget is 0x26C.
Thank you very much. I finally got it right this time!

Posted: Wed Jun 18, 2008 2:44 pm
by shade45
No problem :D

Posted: Wed Jun 18, 2008 2:53 pm
by SPARTAN-OMEGA
Thank you, I never could find current budget :P