Welcome to the Builder Academy

Question Loading Object Error

More
03 Nov 2012 09:21 - 03 Nov 2012 09:38 #973 by Liko
Loading Object Error was created by Liko
I'm getting an error when it's trying to load objects from the .obj file. I tried adding a new obj variable.

Here is the log:
Code:
Nov 3 02:09:55 :: SYSERR: Format error in first numeric line (expecting 14 args, got 1), object #36

Here is the block of the code that it's referring too
Code:
if (((retval = sscanf(line, " %d %d %s %s %s %s %s %s %s %s %s %s %s %s", t, t + 1, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12)) == 4) && (bitwarning == TRUE)) { /* Let's make the implementor read some, before converting his world files. */ log("WARNING: Conventional object files detected. Please see config.c."); exit(1); } else if (((retval == 4) || (retval == 3)) && (bitwarning == FALSE)) { if (retval == 3) t[3] = 0; else if (retval == 4) t[3] = asciiflag_conv_aff(f3); log("Converting object #%d to 128bits..", nr); GET_OBJ_EXTRA(obj_proto + i)[0] = asciiflag_conv(f1); GET_OBJ_EXTRA(obj_proto + i)[1] = 0; GET_OBJ_EXTRA(obj_proto + i)[2] = 0; GET_OBJ_EXTRA(obj_proto + i)[3] = 0; GET_OBJ_WEAR(obj_proto + i)[0] = asciiflag_conv(f2); GET_OBJ_WEAR(obj_proto + i)[1] = 0; GET_OBJ_WEAR(obj_proto + i)[2] = 0; GET_OBJ_WEAR(obj_proto + i)[3] = 0; GET_OBJ_PERM(obj_proto + i)[0] = asciiflag_conv_aff(f3); GET_OBJ_PERM(obj_proto + i)[1] = 0; GET_OBJ_PERM(obj_proto + i)[2] = 0; GET_OBJ_PERM(obj_proto + i)[3] = 0; if(bitsavetodisk) { add_to_save_list(zone_table[real_zone_by_thing(nr)].number, 1); converting = TRUE; } log(" done."); } else if (retval == 13) { GET_OBJ_EXTRA(obj_proto + i)[0] = asciiflag_conv(f1); GET_OBJ_EXTRA(obj_proto + i)[1] = asciiflag_conv(f2); GET_OBJ_EXTRA(obj_proto + i)[2] = asciiflag_conv(f3); GET_OBJ_EXTRA(obj_proto + i)[3] = asciiflag_conv(f4); GET_OBJ_WEAR(obj_proto + i)[0] = asciiflag_conv(f5); GET_OBJ_WEAR(obj_proto + i)[1] = asciiflag_conv(f6); GET_OBJ_WEAR(obj_proto + i)[2] = asciiflag_conv(f7); GET_OBJ_WEAR(obj_proto + i)[3] = asciiflag_conv(f8); GET_OBJ_PERM(obj_proto + i)[0] = asciiflag_conv(f9); GET_OBJ_PERM(obj_proto + i)[1] = asciiflag_conv(f10); GET_OBJ_PERM(obj_proto + i)[2] = asciiflag_conv(f11); GET_OBJ_PERM(obj_proto + i)[3] = asciiflag_conv(f12); t[1] = 0; } else { log("SYSERR: Format error in first numeric line (expecting 14 args, got %d), %s", retval, buf2); exit(1); } /* Object flags checked in check_object(). */ GET_OBJ_TYPE(obj_proto + i) = t[0]; GET_OBJ_WEAPON_TYPE(obj_proto + i) = t[1];

Now I added GET_OBJ_WEAPON_TYPE as t[1] and I believe that is what is crashing it.
Code:
if (((retval = sscanf(line, " %d %d %s %s %s %s %s %s %s %s %s %s %s %s", t, t + 1, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12)) == 4) && (bitwarning == TRUE)) {

I believe I have done something wrong with the above posted code. I looked over it for hours and couldn't figure it out. The only other solution I could think of was adding the missing 0 to the files it says was missing, but really it was only reading the first %d then stopping. Everything does save properly to the .obj file. It's just when loading it. Which again makes me suspect I did something wrong in the above code.

On the code below, you can see the line

5 1 a 0 0 0 ano 0 0 0 0 0 0 0

The 1 is actually showing its saving the WEAPON_TYPE. So I know it's saving.
Code:
#26 spear balance quest~ the spear of balance~ The greatest symbol of balance seeks the hearts of evil and good alike.~ ~ 5 1 a 0 0 0 ano 0 0 0 0 0 0 0 8 10 9 11 1 1000 0 20 0 E spear quest balance~ The Lance of heroes. The spear of mortal man. The shaft of this legendary pike is carved from the wood of the tree of life. Though separated from the tree that gave it life, the wood is a living, thinking entity. Full 6 feet in length, the shaft's wood is smooth and unbroken by any scratch or mark. The head of the spear is a huge dragon's fang, rumored to be from the mouth of the god Balm himself. Etched in runes across the head of the spear are these words. "Find gray where only black and white were before. Seek truth where others seek good and evil. Bring justice through the scales of balance. Then may you wield the truth that is my gift. " ~ A 12 50 A 13 50 A 14 50

Randian(0.0.0)
Owner/Developer
Last edit: 03 Nov 2012 09:38 by Liko.

Please Log in or Create an account to join the conversation.

More
03 Nov 2012 22:39 #976 by Vatiken
Replied by Vatiken on topic Re: Loading Object Error
Code:
GET_OBJ_PERM(obj_proto + i)[2] = 0; GET_OBJ_PERM(obj_proto + i)[3] = 0; if(bitsavetodisk) { add_to_save_list(zone_table[real_zone_by_thing(nr)].number, 1); converting = TRUE; } log(" done."); } else if (retval == 13) { <----------------------- 14 ????? GET_OBJ_EXTRA(obj_proto + i)[0] = asciiflag_conv(f1); GET_OBJ_EXTRA(obj_proto + i)[1] = asciiflag_conv(f2); GET_OBJ_EXTRA(obj_proto + i)[2] = asciiflag_conv(f3); GET_OBJ_EXTRA(obj_proto + i)[3] = asciiflag_conv(f4); GET_OBJ_WEAR(obj_proto + i)[0] = asciiflag_conv(f5);

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
03 Nov 2012 22:45 #977 by Liko
Replied by Liko on topic Re: Loading Object Error

Vatiken wrote:

Code:
GET_OBJ_PERM(obj_proto + i)[2] = 0; GET_OBJ_PERM(obj_proto + i)[3] = 0; if(bitsavetodisk) { add_to_save_list(zone_table[real_zone_by_thing(nr)].number, 1); converting = TRUE; } log(" done."); } else if (retval == 13) { <----------------------- 14 ????? GET_OBJ_EXTRA(obj_proto + i)[0] = asciiflag_conv(f1); GET_OBJ_EXTRA(obj_proto + i)[1] = asciiflag_conv(f2); GET_OBJ_EXTRA(obj_proto + i)[2] = asciiflag_conv(f3); GET_OBJ_EXTRA(obj_proto + i)[3] = asciiflag_conv(f4); GET_OBJ_WEAR(obj_proto + i)[0] = asciiflag_conv(f5);


Well I fixed this. Instead of putting it on a rather long line anyway I put it on its own line. It works like a charm now. :)

Randian(0.0.0)
Owner/Developer

Please Log in or Create an account to join the conversation.

Time to create page: 0.177 seconds