The Forum is up for sale: XeNTaX Forum looking for new owner

could I add multiple ID flags to my bms script?

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
Troopermanaic
advanced
Posts: 71
Joined: Fri Jul 01, 2011 4:29 pm
Has thanked: 5 times
Been thanked: 5 times

could I add multiple ID flags to my bms script?

Post by Troopermanaic »

Im wondering if I am able to add multiple ID flags to my script
example

Code: Select all

if FLAG = 0x##78
I have a bunch of bms scripts that are similar but only have an offset of the second hex code and I want to merge them all into one.
EZ-BMS for when you want to work with non-programmers viewtopic.php?f=33&t=10499
If you like what I do then support my coffee addiction https://www.paypal.com/cgi-bin/webscr?c ... 853S265MPW
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 661 times
Contact:

Re: could I add multiple ID flags to my bms script?

Post by aluigi »

in that case you could use something like:

Code: Select all

math TMP = FLAGS
math TMP &= 0xff # or math TMP %= 0x100
if TMP == 0x78
...
Troopermanaic
advanced
Posts: 71
Joined: Fri Jul 01, 2011 4:29 pm
Has thanked: 5 times
Been thanked: 5 times

Re: could I add multiple ID flags to my bms script?

Post by Troopermanaic »

This works like a charm thanks.

IDK if its because you didn't get to see the whole code but

Code: Select all

TMP == 0x78
was making the script not work. Instead of using it I put

Code: Select all

math TMP &= 0xDA78 # or math TMP %= 0x9C78 or math TMP %= 0x5E78
and it works on all those zlib files even at the same time. =]
EZ-BMS for when you want to work with non-programmers viewtopic.php?f=33&t=10499
If you like what I do then support my coffee addiction https://www.paypal.com/cgi-bin/webscr?c ... 853S265MPW
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 661 times
Contact:

Re: could I add multiple ID flags to my bms script?

Post by aluigi »

you must never use a similar check for zlib data.
in that case if you don't know if a file is compressed is better to use "comtype unzip_dynamic" that will do the check correctly and unpack or copy the data automatically
Troopermanaic
advanced
Posts: 71
Joined: Fri Jul 01, 2011 4:29 pm
Has thanked: 5 times
Been thanked: 5 times

Re: could I add multiple ID flags to my bms script?

Post by Troopermanaic »

the script with this line of code seems to be working 100% fine with absolutely no errors, even can re import with bms. Is there something I should be aware of?

I checked the coding of the decompressed files and they look right. Everything seems to be working this way.
EZ-BMS for when you want to work with non-programmers viewtopic.php?f=33&t=10499
If you like what I do then support my coffee addiction https://www.paypal.com/cgi-bin/webscr?c ... 853S265MPW
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 661 times
Contact:

Re: could I add multiple ID flags to my bms script?

Post by aluigi »

I forgot about reimporting (unzip_dynamic would zip everything, even the uncompressed files).

anyway the file format must have for sure a field in which it says if the file is compressed and what's its size, that will avoid the 0x78 work-around
Atwaetere
ultra-n00b
Posts: 3
Joined: Tue May 29, 2012 7:23 pm
Contact:

Re: could I add multiple ID flags to my bms script?

Post by Atwaetere »

I have the same issue but it wasnt solved with all the hints. Becuase the problem is that i am a bit of a newbie and do not have any experience of what you guys are talking about. it would be very helpful, if someone could post the entire code. It would be a huge learning curve for me and it would be thankful.
Post Reply