JazzJackrabbit Community Forums

JazzJackrabbit Community Forums (http://www.jazz2online.com/jcf/index.php)
-   JCS & Scripting (http://www.jazz2online.com/jcf/forumdisplay.php?f=5)
-   -   Custom .j2a files (http://www.jazz2online.com/jcf/showthread.php?t=19856)

Jelly Jam May 2, 2015 04:18 AM

if ya have jsd, that big area with color blocks is the 256 pallete which is used by jj2, or atleast that's what i think.

XxMoNsTeRXM May 2, 2015 04:46 AM

Quote:

Originally Posted by Jelly Jam (Post 487326)
if ya have jsd, that big area with color blocks is the 256 pallete which is used by jj2, or atleast that's what i think.

Nvm... I found a jj2 palette in my jj2 folder. ;)
EDIT: Wait, there are more colors ;( (in one color, they've got noise)

Violet CLM May 2, 2015 10:24 AM

There's a .pal file included in the pyJ2A.zip that you downloaded. Use that.

XxMoNsTeRXM May 3, 2015 11:53 PM

Quote:

Originally Posted by Violet CLM (Post 487335)
There's a .pal file included in the pyJ2A.zip that you downloaded. Use that.

Ah ok, thanks!

XxMoNsTeRXM May 13, 2015 06:51 AM

Same error.

szmol96 May 24, 2015 08:10 AM

Quote:

Originally Posted by XxMoNsTeRXM (Post 487325)
Where can I get the jj2 palette?

It is included in the zip.

Also, the python files worked like a charm for me, but after importing a png file, the colors got messed up. I have no idea why, because I have loaded the included palette in Paint Shop Pro. Any help would be appreciated.

Violet CLM May 24, 2015 11:17 AM

Without seeing some combination of the png, the .j2a, or the code, it's difficult for me to say anything.

szmol96 May 25, 2015 03:53 AM

Sorry, I was browsing from my phone when I wrote that reply. Anyway, here's the image.
[IMG]http://i.imgur.com/FFXbC0D.png[/IMG]
You can see the original sprite on the left and the one that shows up in JazzSD on the right.

EDIT: Also, here's some additional information. After re-opening the image in Paint Shop Pro, it has the following palette.
[IMG]http://i.imgur.com/ff9jxK6.png[/IMG]

Seren May 25, 2015 04:21 AM

Well that palette clearly isn't the JJ2 palette so the answer is fairly simple. You do need to retain correct palette indices.

szmol96 May 25, 2015 04:42 AM

I can't do that. It keeps sorting out colors that aren't used.

Treylina May 25, 2015 08:11 AM

Well, graphicsgale doesn't do that unless you tell it to remove unused colours. The free version will do fine.

I'm guessing you can stop PSP from removing unused colours, but I don't use that program so I'm useless on that.

Violet CLM May 25, 2015 08:58 AM

In the Save dialog, click "Options" and then uncheck "Optimized palette." The flow/wording may be a bit different depending on your PSP version but it's probably similar.

szmol96 May 28, 2015 06:39 AM

Thanks! I will check it out.

szmol96 Jul 24, 2015 10:45 AM

What am I doing wrong when I get this error from JSD: "Run-time error '11': Division by zero"?

My animation contains only one frame which is 128x16 pixels large, has the palette loaded and an fps.10 file next to it and it is named 0,-125,-8,0,0,0,0.png.

I hope to have included enough info.

Violet CLM Jul 24, 2015 07:31 PM

JSD is not a reliable measure of whether your file was saved correctly. Only JJ2 can tell you that.

szmol96 Jul 25, 2015 03:13 AM

"Tried to load an invalid animation..."
That's the error I get.

Seren Aug 3, 2015 05:38 AM

szmol96's picture triggered the following Python error, resulting in producing an invalid j2a file:
Code:

Traceback (most recent call last):
  File "j2a-import.py", line 164, in <module>
    main()
  File "j2a-import.py", line 108, in main
    data3 += chr(len(pixelstodraw) + 0x80)
ValueError: chr() arg not in range(256)

It can be reliably reproduced with use of a 128x2 picture filled with any non-0 palette entries.
The error can be walked around by appending columns of index 0 pixels on each side of the picture (presumably one side would suffice but I didn't want to check which one it has to be).

XxMoNsTeRXM Sep 24, 2015 06:02 AM

Quote:

Originally Posted by Violet CLM (Post 487017)
You'll probably still have trouble with plus.j2a, but the other two .j2a files in your folder should work fine. FawFul noticed earlier that plus.j2a was accidentally assembled in a way that JJ2+ accepts but j2a-extract doesn't :(

When extracting it I only get half of the images, but I want to do some edits and I need all of the images from plus.j2a :(

Violet CLM Sep 27, 2015 03:53 PM

Does this work? I haven't touched this stuff in a while.

XxMoNsTeRXM Sep 28, 2015 04:23 AM

Quote:

Originally Posted by Violet CLM (Post 488378)
Does this work? I haven't touched this stuff in a while.

Yes, it does.

InfamousStar Oct 5, 2015 04:02 PM

I'm getting this error.

Code:

$ python j2a-extract.py
Please type the filename of the .j2a file you wish to extract:
Anims.j2a
Traceback (most recent call last):
  File "j2a-extract.py", line 40, in
    main()
  File "j2a-extract.py", line 9, in main
    j2a.read_header()
  File "censored/j2a.py", line 54, in read_header
    offset = struct.unpack("L", self.j2afile[self._headersize+(i*4):self._headersize+(i*4)+4])[0]
struct.error: unpack requires a string argument of length 8


Seren Oct 5, 2015 11:59 PM

I don't know Python, but as far as I can tell, the meaning of that line is implementation-defined, dependent on type size. It should work in almost all popular data models with the main exception of LP64. Are you on 64-bit Linux? Anyway, try modifying line 54 of j2a.py by changing "L" to "I".

InfamousStar Oct 6, 2015 06:48 AM

Yeah, I'm on 64-bit Linux. Changing "L" to "l" just switched it from unsigned to signed long, so that didn't work. But you were right about what was going wrong. My solution was to change it to "<L" which locks it to 4-bytes little endian.

Seren Oct 6, 2015 07:24 AM

I said "I" as in capital "i", standing for "int", which is 4 bytes in LP64, not "l" as in lowercase "L", but glad you solved it.

InfamousStar Oct 8, 2015 05:44 AM

Oh. l hate sans serif fonts sometimes.

XxMoNsTeRXM Feb 26, 2017 04:28 AM

I have a problem while trying to draw a sprite from a custom j2a file, a 800x600 png image. I am converting the image from a different palette to the JJ2's Palette. After I convert it and I save it in the specified format (0,-1,-1,0,0,0,0.png), j2a-import.py manages to import it in a .j2a file, but when I try to load from it, it gives me an Access Violation saying that the j2a is corrupt. The error is probably from how it is converted to the jj2 palette. I used GIMP to convert it to the jj2 palette.

Violet CLM Feb 26, 2017 09:54 AM

I think the .py would have complained if the image weren't properly paletted. It may be an obscure issue with the image size... could you PM the image to me, maybe?

XxMoNsTeRXM Feb 26, 2017 10:02 AM

Quote:

Originally Posted by Violet CLM (Post 491158)
I think the .py would have complained if the image weren't properly paletted. It may be an obscure issue with the image size... could you PM the image to me, maybe?

The unconverted image or the converted image?

Violet CLM Feb 26, 2017 01:48 PM

Code:

void onLevelLoad() {
        jjAnimSets[ANIM::CUSTOM[0]].load(0, "Camel.j2a");
}
void onDrawLayer8(jjPLAYER@, jjCANVAS@ screen) {
        screen.drawSprite(1,1, ANIM::CUSTOM[0], 0, 0);
}

Works fine for me, no errors. Saved as the only file in folder "0" in folder "0" in folder "Camel-j2a".

XxMoNsTeRXM Feb 27, 2017 04:42 AM

I am using Linux btw, could that be the problem? I used Python 2.7. Does the python script use a Windows-based function?
Edit: It doesn't look that there's any file path problem.

Violet CLM Feb 27, 2017 07:56 AM

There's a windows-vs.-linux discussion a bit farther up this page... that was about the extract script, not the import, but you might have similar success looking for instances of struct.pack in the script and trying to force the size/endianness/whatever to work on your system.

XxMoNsTeRXM Feb 27, 2017 08:19 AM

So if I change every 'l' in struct.pack to 'I', it should probably work, right?
That didn't help.
It might have helped, now I don't get crashed. But the image doesn't show now.
I think I have to change to I some specific struct.pack s
How am I suppose to find out which of them to change?

Nvm... I figured it out!

Darkhog Nov 30, 2017 12:56 PM

Could you try using py2exe so one won't have to have Python to use the tool (py2exe AFAIK embeds Python interpreter and all used libraries in the exe)? Because Python changes much even in the minor versions or it can simply not work on someone's system, as it's case with me. I mean, the interpreter and IDLE runs for me, it's just that it's unable to find even the basic libs. And yes, I have my %PATH% set correctly. I guess Python's compatibility with Win8, at least for the 2.x branch is pretty dodgy.

Never had any issues with scripts that were ran through py2exe so if you'd do that, it should work.

Violet CLM Dec 2, 2017 10:02 PM

I just spent an hour or so fiddling with py2exe and cxfreeze, and neither of them produced working executables, and so I've lost interest.

Darkhog Dec 3, 2017 01:18 PM

Darn. Feels bad. Maybe someone else will have more luck?


All times are GMT -8. The time now is 02:42 AM.

Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online