Welcome to the Builder Academy

Question Question.

More
14 Nov 2012 03:48 #1042 by Liko
Question. was created by Liko
Well, I have finished my socket code. There is one tiny error, I need to address. While patching it to make sure it works into stock TbaMud. I noticed that I need to mass update all the .obj files for the new fourth line %d %d. How would I go about doing this? I don't want people to have to delete their object files just for this socket system.

Randian(0.0.0)
Owner/Developer

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

More
14 Nov 2012 05:25 #1044 by zusuk
Replied by zusuk on topic Re: Question.
You mind posting how you are saving/loading your new object attribute? If it is being saved/loaded by reference to a letter, I don't think you'll need to change anything in your object files, just make sure you have a default value initializing at load time. Then when you modify/save an item, that individual item should work fine.

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

More
14 Nov 2012 12:11 - 14 Nov 2012 12:56 #1046 by Liko
Replied by Liko on topic Re: Question.
Loading:
Code:
if (!get_line(obj_f, line)) { log("SYSERR: Expecting fourth numeric line of %s, but file ended!", buf2); exit(1); } if ((retval = sscanf(line, "%d %d", t, t + 1)) != 2) { if(retval == 0) { t[0] = 0; t[1] = 0; } else if(retval == 1) t[1] = 0; else { log("SYSERR: Format error in fourth numeric line (expecting 2 args, got %d), %s", retval, buf2); exit(1); } } GET_OBJ_SOCKET_MIN(obj_proto + i) = t[0]; GET_OBJ_SOCKET_MAX(obj_proto + i) = t[1]; case 'B': if (b >= MAX_SOCKET_AFFECT) { log("SYSERR: Too many B fields (%d max), %s", MAX_SOCKET_AFFECT, buf2); exit(1); } if (!get_line(obj_f, line)) { log("SYSERR: Format error in 'B' field, %s\n" "...expecting 2 numeric constants but file ended!", buf2); exit(1); } if ((retval = sscanf(line, " %d %d ", t, t + 1)) != 2) { log("SYSERR: Format error in 'B' field, %s\n" "...expecting 2 numeric arguments, got %d\n" "...offending line: '%s'", buf2, retval, line); exit(1); } obj_proto[i].bonus[b].location = t[0]; obj_proto[i].bonus[b].modifier = t[1]; b++; break;

Saving:
GENOBJ.C
Code:
fprintf(fp, "%d %s %s %s %s %s %s %s %s %s %s %s %s\n" "%d %d %d %d\n" "%d %d %d %d %d\n" "%d %d\n", GET_OBJ_TYPE(obj), ebuf1, ebuf2, ebuf3, ebuf4, wbuf1, wbuf2, wbuf3, wbuf4, pbuf1, pbuf2, pbuf3, pbuf4, GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3), GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj), GET_OBJ_TIMER(obj), GET_OBJ_SOCKET_MIN(obj), GET_OBJ_SOCKET_MAX(obj) ); for (counter3 = 0; counter3 < MAX_SOCKET_AFFECT; counter3++) if(obj->bonus[counter3].modifier) fprintf(fp, "B\n" "%d %d\n", obj->bonus[counter3].location, obj->bonus[counter3].modifier);

OBJSAVE.c
Code:
for (counter3 = 0; counter3 < MAX_SOCKET_AFFECT; counter3++) if (obj->bonus[counter3].modifier != temp->bonus[counter3].modifier) fprintf(fp, "Bon : %d %d %d\n", counter3, obj->bonus[counter3].location, obj->bonus[counter3].modifier ); if (!strcmp(tag, "Bon ")) { sscanf(line, "%d %d %d", &t[0], &t[1], &t[2]); if(t[0] < MAX_SOCKET_AFFECT) { temp->bonus[t[0]].location = t[1]; temp->bonus[t[0]].modifier = t[2]; } } break;

The error i'm getting is:
Code:
strcat(buf2, ", after numeric constants\n" /* strcat: OK (for 'buf2 >= 87') */ "...expecting 'E', 'A', 'B', '$', or next object number");

Randian(0.0.0)
Owner/Developer
Last edit: 14 Nov 2012 12:56 by Liko.

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

More
14 Nov 2012 19:12 #1047 by zusuk
Replied by zusuk on topic Re: Question.
It's looking for 'B' as you requested in the loading (the case 'B' loading)

You labeled it as 'Bon: ' for saving

There might be other errors too, but I think that's the one the error is pointing out.

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

More
14 Nov 2012 19:31 #1048 by Liko
Replied by Liko on topic Re: Question.

Liko wrote: Loading:

Code:
if (!get_line(obj_f, line)) { log("SYSERR: Expecting fourth numeric line of %s, but file ended!", buf2); exit(1); } if ((retval = sscanf(line, "%d %d", t, t + 1)) != 2) { if(retval == 0) { t[0] = 0; t[1] = 0; } else if(retval == 1) t[1] = 0; else { log("SYSERR: Format error in fourth numeric line (expecting 2 args, got %d), %s", retval, buf2); exit(1); } } GET_OBJ_SOCKET_MIN(obj_proto + i) = t[0]; GET_OBJ_SOCKET_MAX(obj_proto + i) = t[1]; case 'B': if (b >= MAX_SOCKET_AFFECT) { log("SYSERR: Too many B fields (%d max), %s", MAX_SOCKET_AFFECT, buf2); exit(1); } if (!get_line(obj_f, line)) { log("SYSERR: Format error in 'B' field, %s\n" "...expecting 2 numeric constants but file ended!", buf2); exit(1); } if ((retval = sscanf(line, " %d %d ", t, t + 1)) != 2) { log("SYSERR: Format error in 'B' field, %s\n" "...expecting 2 numeric arguments, got %d\n" "...offending line: '%s'", buf2, retval, line); exit(1); } obj_proto[i].bonus[b].location = t[0]; obj_proto[i].bonus[b].modifier = t[1]; b++; break;

Saving:
GENOBJ.C
Code:
fprintf(fp, "%d %s %s %s %s %s %s %s %s %s %s %s %s\n" "%d %d %d %d\n" "%d %d %d %d %d\n" "%d %d\n", GET_OBJ_TYPE(obj), ebuf1, ebuf2, ebuf3, ebuf4, wbuf1, wbuf2, wbuf3, wbuf4, pbuf1, pbuf2, pbuf3, pbuf4, GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3), GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj), GET_OBJ_TIMER(obj), GET_OBJ_SOCKET_MIN(obj), GET_OBJ_SOCKET_MAX(obj) ); for (counter3 = 0; counter3 < MAX_SOCKET_AFFECT; counter3++) if(obj->bonus[counter3].modifier) fprintf(fp, "B\n" "%d %d\n", obj->bonus[counter3].location, obj->bonus[counter3].modifier);

OBJSAVE.c
Code:
for (counter3 = 0; counter3 < MAX_SOCKET_AFFECT; counter3++) if (obj->bonus[counter3].modifier != temp->bonus[counter3].modifier) fprintf(fp, "Bon : %d %d %d\n", counter3, obj->bonus[counter3].location, obj->bonus[counter3].modifier ); if (!strcmp(tag, "Bon ")) { sscanf(line, "%d %d %d", &t[0], &t[1], &t[2]); if(t[0] < MAX_SOCKET_AFFECT) { temp->bonus[t[0]].location = t[1]; temp->bonus[t[0]].modifier = t[2]; } } break;

The error i'm getting is:
Code:
strcat(buf2, ", after numeric constants\n" /* strcat: OK (for 'buf2 >= 87') */ "...expecting 'E', 'A', 'B', '$', or next object number");


OBJSAVE.c is just saving the bonues. genobj.c is where "B" is defined.

Randian(0.0.0)
Owner/Developer

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

More
14 Nov 2012 21:05 #1049 by zusuk
Replied by zusuk on topic Re: Question.
Ahhh heheh, that's what I get for not paying attention...

It is unclear to me :( You're pointing to a line of code as your error, I'm not sure what that means.

I'm sure your familiar with the object saving format default:
Code:
#1 wings~ a pair of wings~ A pair of wings is sitting here.~ ~ 9 0 0 0 0 ae 0 0 0 0 0 0 0 6 0 0 0 1 1 0 0 0 I <---------------- I'm guessing you might have wrong data saved right here 5 G 0 H 0

You made sure you are saving the 'B' data AFTER the ex-descs and affects data too I assume? If your genobj.c is a direct copy of your code, it looks like you are saving your B field data before the ex-desc/affects.

I am kinda just stabbing in the dark though, is it a compiling error? Is it compiling fine and you getting some error message when you try running the MUD in the logs?

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

Time to create page: 0.245 seconds