Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

Custom .j2a files

Reply
 
Thread Tools
Jelly Jam Jelly Jam's Avatar

JCF Member

Joined: Oct 2014

Posts: 775

Jelly Jam is doing well so far

May 2, 2015, 05:18 AM
Jelly Jam is offline
Reply With Quote
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 XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

May 2, 2015, 05:46 AM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Jelly Jam View Post
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)
__________________
~XxMoNsTeR
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

May 2, 2015, 11:24 AM
Violet CLM is offline
Reply With Quote
There's a .pal file included in the pyJ2A.zip that you downloaded. Use that.
__________________
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

May 4, 2015, 12:53 AM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
There's a .pal file included in the pyJ2A.zip that you downloaded. Use that.
Ah ok, thanks!
__________________
~XxMoNsTeR

Last edited by XxMoNsTeRXM; May 13, 2015 at 07:51 AM.
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

May 13, 2015, 07:51 AM
XxMoNsTeRXM is offline
Reply With Quote
Same error.
__________________
~XxMoNsTeR

Last edited by XxMoNsTeRXM; Feb 26, 2017 at 02:32 AM.
szmol96 szmol96's Avatar

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

May 24, 2015, 09:10 AM
szmol96 is offline
Reply With Quote
Quote:
Originally Posted by XxMoNsTeRXM View Post
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.
__________________
All your base are belong to us.

Last edited by szmol96; May 24, 2015 at 09:14 AM. Reason: misspelling
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

May 24, 2015, 12:17 PM
Violet CLM is offline
Reply With Quote
Without seeing some combination of the png, the .j2a, or the code, it's difficult for me to say anything.
__________________
szmol96 szmol96's Avatar

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

May 25, 2015, 04:53 AM
szmol96 is offline
Reply With Quote
Sorry, I was browsing from my phone when I wrote that reply. Anyway, here's the image.

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.
__________________
All your base are belong to us.

Last edited by szmol96; May 25, 2015 at 05:21 AM.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

May 25, 2015, 05:21 AM
Seren is offline
Reply With Quote
Well that palette clearly isn't the JJ2 palette so the answer is fairly simple. You do need to retain correct palette indices.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
szmol96 szmol96's Avatar

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

May 25, 2015, 05:42 AM
szmol96 is offline
Reply With Quote
I can't do that. It keeps sorting out colors that aren't used.
__________________
All your base are belong to us.
Treylina Treylina's Avatar

JCF Member

Joined: Sep 2009

Posts: 1,046

Treylina is a forum legendTreylina is a forum legendTreylina is a forum legend

May 25, 2015, 09:11 AM
Treylina is offline
Reply With Quote
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.
__________________


Jazz Jackrabbit group: https://discord.gg/vZm95tQ
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

May 25, 2015, 09:58 AM
Violet CLM is offline
Reply With Quote
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 szmol96's Avatar

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

May 28, 2015, 07:39 AM
szmol96 is offline
Reply With Quote
Thanks! I will check it out.
__________________
All your base are belong to us.
szmol96 szmol96's Avatar

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

Jul 24, 2015, 11:45 AM
szmol96 is offline
Reply With Quote
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.
__________________
All your base are belong to us.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jul 24, 2015, 08:31 PM
Violet CLM is offline
Reply With Quote
JSD is not a reliable measure of whether your file was saved correctly. Only JJ2 can tell you that.
__________________
szmol96 szmol96's Avatar

JCF Member

Joined: Jun 2013

Posts: 83

szmol96 is doing well so far

Jul 25, 2015, 04:13 AM
szmol96 is offline
Reply With Quote
"Tried to load an invalid animation..."
That's the error I get.
__________________
All your base are belong to us.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Aug 3, 2015, 06:38 AM
Seren is offline
Reply With Quote
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).
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Sep 24, 2015, 07:02 AM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
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
__________________
~XxMoNsTeR
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Sep 27, 2015, 04:53 PM
Violet CLM is offline
Reply With Quote
Does this work? I haven't touched this stuff in a while.
__________________
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Sep 28, 2015, 05:23 AM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
Does this work? I haven't touched this stuff in a while.
Yes, it does.
__________________
~XxMoNsTeR

Last edited by XxMoNsTeRXM; Feb 26, 2017 at 02:32 AM.
InfamousStar

JCF Member

Joined: Oct 2015

Posts: 6

InfamousStar is doing well so far

Oct 5, 2015, 05:02 PM
InfamousStar is offline
Reply With Quote
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 Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Oct 6, 2015, 12:59 AM
Seren is offline
Reply With Quote
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

JCF Member

Joined: Oct 2015

Posts: 6

InfamousStar is doing well so far

Oct 6, 2015, 07:48 AM
InfamousStar is offline
Reply With Quote
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 Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Oct 6, 2015, 08:24 AM
Seren is offline
Reply With Quote
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

JCF Member

Joined: Oct 2015

Posts: 6

InfamousStar is doing well so far

Oct 8, 2015, 06:44 AM
InfamousStar is offline
Reply With Quote
Oh. l hate sans serif fonts sometimes.
XxMoNsTeRXM XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Feb 26, 2017, 04:28 AM
XxMoNsTeRXM is offline
Reply With Quote
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.
__________________
~XxMoNsTeR
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Feb 26, 2017, 09:54 AM
Violet CLM is offline
Reply With Quote
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 XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Feb 26, 2017, 10:02 AM
XxMoNsTeRXM is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
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?
__________________
~XxMoNsTeR
Old Feb 26, 2017, 11:56 AM
Violet CLM
This message has been deleted by Violet CLM. Reason: deleting in order to bump thread
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Feb 26, 2017, 01:48 PM
Violet CLM is offline
Reply With Quote
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 XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Feb 27, 2017, 04:42 AM
XxMoNsTeRXM is offline
Reply With Quote
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.
__________________
~XxMoNsTeR

Last edited by XxMoNsTeRXM; Feb 27, 2017 at 05:50 AM.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Feb 27, 2017, 07:56 AM
Violet CLM is offline
Reply With Quote
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 XxMoNsTeRXM's Avatar

JCF Member

Joined: Sep 2013

Posts: 191

XxMoNsTeRXM is doing well so far

Feb 27, 2017, 08:19 AM
XxMoNsTeRXM is offline
Reply With Quote
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!
__________________
~XxMoNsTeR

Last edited by XxMoNsTeRXM; Feb 27, 2017 at 09:08 AM.
Darkhog Darkhog's Avatar

JCF Member

Joined: May 2012

Posts: 227

Darkhog is notorious for his worthless posts

Nov 30, 2017, 12:56 PM
Darkhog is offline
Reply With Quote
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.
__________________
Code:
    .──.
   │O_O │
   ││_╱ │
  ╱╱   │╲
 (|▔╲  │ )
╱'╲_▔ _╱`╲
╲___) (___╱  TUX LOVES YOU.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Dec 2, 2017, 10:02 PM
Violet CLM is offline
Reply With Quote
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 Darkhog's Avatar

JCF Member

Joined: May 2012

Posts: 227

Darkhog is notorious for his worthless posts

Dec 3, 2017, 01:18 PM
Darkhog is offline
Reply With Quote
Darn. Feels bad. Maybe someone else will have more luck?
__________________
Code:
    .──.
   │O_O │
   ││_╱ │
  ╱╱   │╲
 (|▔╲  │ )
╱'╲_▔ _╱`╲
╲___) (___╱  TUX LOVES YOU.
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 03:17 AM.