Carnivores, Carnivores 2, Carnivores Ice Age

The Original Forum. Game archives, full of resources. How to open them? Get help here.
machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 1:56 am

Mr.Mouse wrote:I see, well, I will take a look at the script and alter it.
I've tested the script from within Mex3Scriptor, deleting some sections and adding them gradually. The file explo.car is read without problems as long as the script doesn't attempt to read the sounds at the end (of which that file has none), otherwise it's "Get called with invalid datatype", followed by "File number must be specified", and the same happens with Wind.car and Wcircle2.car (which have no sounds either). With the Sship1.car file, the problem happens when it attempts to read the animations (and that file has none), giving an "overflow" error ("Run-time error '6'") and crashing the program; it works if I omit the for-next loop for the animations.

I've decided to attach the Sship1.car file to this post in case you want to test it too.
You do not have the required permissions to view the files attached to this post.

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 5:46 am

I've made a corrected version of your .CAR script, now it loads the Explo.car, Wcircle2.car and Wind.car files, but alas, not the Sship1.car file yet...

Code: Select all

GoTo 32 0 ;
Get numAnim Long 0 ;
Get numSound Long 0 ;
Get numPoint Long 0 ;
Get numTri Long 0 ;
Get picSize Long 0 ;
If numTri > 0 ;
For nT = 1 To numTri ;
SavePos FOT 0 ;
Set FST Long 64 ;
Log "" FOT FST 0 0 ;
Math FOT += FST ;
GoTo FOT 0 ;
Next nT ;
Else ;
EndIf ;
If numPoint > 0 ;
For nP = 1 To numPoint ;
SavePos FOP 0 ;
Set FSP Long 16 ;
Log "" FOP FSP 0 0 ;
Math FOP += FSP ;
GoTo FOP 0 ;
Next nP ;
Else ;
EndIf ;
If picSize > 0 ;
SavePos FO 0 ;
Log "" FO picSize 0 0 ;
Math FO += picSize ;
GoTo FO 0 ;
Else ;
EndIf ;
For nA = 1 To numAnim ;
SavePos FOA 0 ;
GetDString FNA 32 0 ;
Get FDA Long 0 ;
Get JPA2 Long 0 ;
Math JPA2 *= numPoint ;
Math JPA2 *= 6 ;
Set FSA Long 40 ;
Math FSA += JPA2 ;
Log "" FOA FSA 0 0 ;
Math FOA += FSA ;
GoTo FOA 0 ;
Next nA ;
For nS = 1 To numSound ;
SavePos FOS 0 ;
GetDString FNS 32 0 ;
Get JPS2 Long 0 ;
Set FSS Long 36 ;
Math FSS += JPS2 ;
Log "" FOS FSS 0 0 ;
Math FOS += FSS ;
GoTo FOS 0 ;
Next nS ;
If I attempt to use an If... Else...Endif conditional around the animations for...next loop, the script seems to enter an infinite loop with any file. If I don't, it just crashes with an overflow error when I attempt to load Sship1.car.
You do not have the required permissions to view the files attached to this post.

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 8:30 am

I managed to correct those problems, but now the program (MultiEx Commander, not the scripter) crashes with a runtime error 9 ('Subscript out of range') whenever I attempt to extract any part of the files or even by just clicking on them...

Code: Select all

SavePos st 0 ;
GetDString nameFile 24 0 ;
SavePos ex 0 ;
GetDString extraFile 8 0 ;
Set FileName String nameFile ;
Set FileExtra String extraFile ;
Set A Long 24 ;
Set B Long 8 ;
Log FileName st A 0 0 ;
Log FileExtra ex B 0 0 ;
Get numAnim Long 0 ;
Get numSound Long 0 ;
Get numPoint Long 0 ;
Get numTri Long 0 ;
Get picSize Long 0 ;
For nT = 1 To numTri ;
SavePos FOT 0 ;
Set FST Long 64 ;
Log "" FOT FST 0 0 ;
Math FOT += FST ;
GoTo FOT 0 ;
Next nT ;
For nP = 1 To numPoint ;
SavePos FOP 0 ;
Set FSP Long 16 ;
Log "" FOP FSP 0 0 ;
Math FOP += FSP ;
GoTo FOP 0 ;
Next nP ;
SavePos FO 0 ;
Log "" FO picSize 0 0 ;
Math FO += picSize ;
GoTo FO 0 ;
If numAnim = 0 ;
SavePos FOA 0 ;
Else ;
For nA = 1 To numAnim ;
GetDString FNA 32 0 ;
SavePos FOA 0 ;
Get divCoord Long 0 ;
Get numFrames Long 0 ;
Math numFrames *= numPoint ;
Math numFrames *= 6 ;
Set FSA Long 8 ;
Math numFrames += FSA ;
Log FNA FOA numFrames 0 0 ;
Math FOA += numFrames ;
GoTo FOA 0 ;
Next nA ;
EndIf ;
For nS = 1 To numSound ;
GetDString FNS 32 0 ;
Get JPS2 Long 0 ;
SavePos FOS 0 ;
Log FNS FOS JPS2 0 0 ;
Math FOS += JPS2 ;
GoTo FOS 0 ;
Next nS ;
Maybe it has to do with the filenames?

User avatar
Mr.Mouse
Site Admin
Posts: 4051
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 421 times
Been thanked: 575 times
Contact:

Post by Mr.Mouse » Wed Mar 02, 2005 8:35 am

You are using the "Use custom BMS on..." option? Please don't.
It's bugged, as you may or may not have read in other threads on this forum. :(

You should follow this procedure if you wish to use a new/custom BMS:

viewtopic.php?t=1098

The bug is removed in the next release.

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 8:47 am

Oh, OK... I wanted to avoid overwriting the mc.mrf file until I got the thing working properly, but if you say so...

It looks like it's working fine now, though I may refine it a bit yet. That will have to wait until tomorrow, I'm off to sleep right now.

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 3:52 pm

Well, here are the revised scripts for the Carnivores .CAR and .3DF formats:

3DF.bms

Code: Select all

Get numPoint Long 0 ;
Get numTri Long 0 ;
Get numJoint Long 0 ;
Get picSize Long 0 ;
Set A Long 0 ;
Set B Long 5 ;
Log "" A B 0 0 ;
For nT = 1 To numTri ;
SavePos FOT 0 ;
Set FST Long 64 ;
Log "" FOT FST 0 0 ;
Math FOT += FST ;
GoTo FOT 0 ;
Next nT ;
For nP = 1 To numPoint ;
SavePos FOP 0 ;
Set FSP Long 16 ;
Log "" FOP FSP 0 0 ;
Math FOP += FSP ;
GoTo FOP 0 ;
Next nP ;
For nJ = 1 To numJoint ;
SavePos FOP 0 ;
Set FSJ Long 48 ;
Log "" FOJ FSJ 0 0 ;
Math FOJ += FSJ ;
GoTo FOJ 0 ;
Next nJ ;
SavePos FO 0 ;
Log "" FO picSize 0 0 ;
Math FO += picSize ;
GoTo FO 0 ;
CAR.bms

Code: Select all

SavePos st 0 ;
GetDString nameFile 24 0 ;
SavePos ex 0 ;
GetDString extraFile 8 0 ;
Get numAnim Long 0 ;
Get numSound Long 0 ;
Get numPoint Long 0 ;
Get numTri Long 0 ;
Get picSize Long 0 ;
Set FileName String nameFile ;
Set FileExtra String extraFile ;
Set A Long 24 ;
Set B Long 7 ;
Log FileName ex B 0 0 ;
For nT = 1 To numTri ;
SavePos FOT 0 ;
Set FST Long 64 ;
Log "" FOT FST 0 0 ;
Math FOT += FST ;
GoTo FOT 0 ;
Next nT ;
For nP = 1 To numPoint ;
SavePos FOP 0 ;
Set FSP Long 16 ;
Log "" FOP FSP 0 0 ;
Math FOP += FSP ;
GoTo FOP 0 ;
Next nP ;
SavePos FO 0 ;
Log "" FO picSize 0 0 ;
Math FO += picSize ;
GoTo FO 0 ;
If numAnim = 0 ;
SavePos FOA 0 ;
Else ;
For nA = 1 To numAnim ;
GetDString FNA 32 0 ;
Set FileName String FNA ;
SavePos FOA 0 ;
Get divCoord Long 0 ;
Get numFrames Long 0 ;
Math numFrames *= numPoint ;
Math numFrames *= 6 ;
Set FSA Long 8 ;
Math numFrames += FSA ;
Log FileName FOA numFrames 0 0 ;
Math FOA += numFrames ;
GoTo FOA 0 ;
Next nA ;
EndIf ;
For nS = 1 To numSound ;
GetDString FNS 32 0 ;
Set FileName String FNS ;
Get JPS2 Long 0 ;
SavePos FOS 0 ;
Log FileName FOS JPS2 0 0 ;
Math FOS += JPS2 ;
GoTo FOS 0 ;
Next nS ;
If numSound > 0 ;
Set XREF Long 64 ;
Log "" FOS XREF 0 0 ;
Else ;
EndIf ;
(Though that "EndIf ;" at the end keeps disappearing whenever I reload the file)
You do not have the required permissions to view the files attached to this post.

User avatar
Mr.Mouse
Site Admin
Posts: 4051
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 421 times
Been thanked: 575 times
Contact:

Post by Mr.Mouse » Wed Mar 02, 2005 3:56 pm

Yes, I noticed that bug as well, the disappearing EndIf. :roll: Will fix. Thanks for the scripts!

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 3:59 pm

I guess in the meantime the whole last If..Endif block could be left out until it's working properly...

BTW, is there a way to add text to an already existing string or define one from scratch? Looking at a lot of "nonameNN" entries isn't too informative...

User avatar
Mr.Mouse
Site Admin
Posts: 4051
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 421 times
Been thanked: 575 times
Contact:

Post by Mr.Mouse » Wed Mar 02, 2005 4:07 pm

Well, you could just write another last statement there like "Set DUMMY Long 0 ; ", right behind the last EndIf. you will see that the EndIf now stays. :mrgreen:

And no, I haven't included that "create your own string option". Might do, though. Some string functions. :|

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Wed Mar 02, 2005 4:20 pm

OK, thanks. Here's another quick question: is there a way to add data before saving a block? Since with the addition of the proper headers (18 bytes for a .TGA file, 40 bytes for a .WAV file) one could extract the texture and sound data directly to standard formats...

User avatar
Dinoguy1000
Site Admin
Posts: 759
Joined: Mon Sep 13, 2004 1:55 am
Has thanked: 129 times
Been thanked: 142 times

Post by Dinoguy1000 » Wed Mar 02, 2005 4:52 pm

Wow, nice work, machf! I still need to learn a scripting language (like JS), I have a feeling that writing scripts for MexCom would be much easier if I had one under my belt... I keep meaning to take the time to learn one, but I never get around to it... :(
Welcome to Xentax!

Rules | Requests | Wiki | Discord

If you run across a post that breaks the rules, please report the post - a mod or admin will handle it from there.

User avatar
Mr.Mouse
Site Admin
Posts: 4051
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 421 times
Been thanked: 575 times
Contact:

Post by Mr.Mouse » Wed Mar 02, 2005 5:26 pm

machf wrote:OK, thanks. Here's another quick question: is there a way to add data before saving a block? Since with the addition of the proper headers (18 bytes for a .TGA file, 40 bytes for a .WAV file) one could extract the texture and sound data directly to standard formats...
Well, there's none built in. You see, the script was written so, that generic formats could be included. If a game doesn't care about headers and removes them to save space or some other reason, the script can't do anything about that, as it was not written to be able to handle such specific details, that are not common. Still, the option would be nice to have, perhaps an "AddHeader <path> ;" command would be nice. Let me think about it. :)

machf
beginner
Posts: 25
Joined: Tue Feb 15, 2005 5:42 am

Post by machf » Sun Mar 06, 2005 8:57 pm

I've made yet another modification to both scripts...


First, the .3DF script now also displays the joint/bone names the same way the .CAR script does with the sound and animation names:
Get numPoint Long 0 ;
Get numTri Long 0 ;
Get numJoint Long 0 ;
Get picSize Long 0 ;
Set A Long 0 ;
Set B Long 5 ;
Log "" A B 0 0 ;
For nT = 1 To numTri ;
SavePos FOT 0 ;
Set FST Long 64 ;
Log "" FOT FST 0 0 ;
Math FOT += FST ;
GoTo FOT 0 ;
Next nT ;
For nP = 1 To numPoint ;
SavePos FOP 0 ;
Set FSP Long 16 ;
Log "" FOP FSP 0 0 ;
Math FOP += FSP ;
GoTo FOP 0 ;
Next nP ;
For nJ = 1 To numJoint ;
GetDString FNJ 32 0 ;
Set FileName String FNJ ;
SavePos FOJ 0 ;
Set FSJ Long 16 ;
Log FileName FOJ FSJ 0 0 ;
Math FOJ += FSJ ;
GoTo FOJ 0 ;
Next nJ ;
SavePos FO 0 ;
Log "" FO picSize 0 0 ;
Math FO += picSize ;
GoTo FO 0 ;
And second, I did something else to the .CAR script to attempt to read the xref table at the nd with the help of an If..Else..Endif conditional (though it doesn't work properly with this version, apaprently the conditional is ignored, resulting in a 0-bytes block when the xref table isn't present):

SavePos st 0 ;
GetDString nameFile 24 0 ;
SavePos ex 0 ;
GetDString extraFile 8 0 ;
Get numAnim Long 0 ;
Get numSound Long 0 ;
Get numPoint Long 0 ;
Get numTri Long 0 ;
Get picSize Long 0 ;
Set FileName String nameFile ;
Set FileExtra String extraFile ;
Set A Long 24 ;
Set B Long 7 ;
Log FileName ex B 0 0 ;
For nT = 1 To numTri ;
SavePos FOT 0 ;
Set FST Long 64 ;
Log "" FOT FST 0 0 ;
Math FOT += FST ;
GoTo FOT 0 ;
Next nT ;
For nP = 1 To numPoint ;
SavePos FOP 0 ;
Set FSP Long 16 ;
Log "" FOP FSP 0 0 ;
Math FOP += FSP ;
GoTo FOP 0 ;
Next nP ;
SavePos FO 0 ;
Log "" FO picSize 0 0 ;
Math FO += picSize ;
GoTo FO 0 ;
If numAnim = 0 ;
SavePos FOA 0 ;
Else ;
For nA = 1 To numAnim ;
GetDString FNA 32 0 ;
Set FileName String FNA ;
SavePos FOA 0 ;
Get divCoord Long 0 ;
Get numFrames Long 0 ;
Math numFrames *= numPoint ;
Math numFrames *= 6 ;
Set FSA Long 8 ;
Math numFrames += FSA ;
Log FileName FOA numFrames 0 0 ;
Math FOA += numFrames ;
GoTo FOA 0 ;
Next nA ;
EndIf ;
For nS = 1 To numSound ;
GetDString FNS 32 0 ;
Set FileName String FNS ;
Get JPS2 Long 0 ;
SavePos FOS 0 ;
Log FileName FOS JPS2 0 0 ;
Math FOS += JPS2 ;
GoTo FOS 0 ;
Next nS ;
If numSound = 0 ;
SavePos Table 0 ;
Else ;
SavePos Table 0 ;
Set XREF Long 64 ;
Log "" Table XREF 0 0 ;
EndIf ;
GoTo 0 0 ;
You do not have the required permissions to view the files attached to this post.

User avatar
Mr.Mouse
Site Admin
Posts: 4051
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 421 times
Been thanked: 575 times
Contact:

Post by Mr.Mouse » Sun Mar 06, 2005 9:45 pm

Okay , good. By the way, I have fixed the If-bug and that will work better in the next version. Also, I have included commands for a bit of string manipulation, so now you can edit filenames prior logging them. Though the next version will need a registration (either by donation or other means of support) for this type of advanced usage, you will recieve a code, as you already donated your support ;) :D

User avatar
Dinoguy1000
Site Admin
Posts: 759
Joined: Mon Sep 13, 2004 1:55 am
Has thanked: 129 times
Been thanked: 142 times

Post by Dinoguy1000 » Sun Mar 06, 2005 11:50 pm

I know this might sound like I'm trying to take credit when I really didn't work on the scripts themselves any, but will I recieve a code for my part? :?:
Welcome to Xentax!

Rules | Requests | Wiki | Discord

If you run across a post that breaks the rules, please report the post - a mod or admin will handle it from there.

Post Reply