31 Jan, 2010, triskaledia wrote in the 1st comment:
Votes: 0
I use Thri's Mob Quest code (Tried adding them to AIM to let them know, but no response yet, so if they read this, they now know). He's left out a few things… like how to save the quests completed to the pfiles.
if (ch->quest_temp != 0)
fprintf(fp, "QTEMP %s\n", print_flags (ch->quest_temp));
if (ch->quest_1 != 0)
fprintf(fp, "QCOMP %s\n", print_flags (ch->quest_1));
if (ch->quest_current != 0)
fprintf(fp, "QCUR %s\n", print_flags (ch->quest_current));

I came up with that after thinking, eh, just copy how affects save since they are on a similar pattern. No problem with that so far. The real reason I'm posting though is because I wanted to make a command that would show the players what mob quests they've completed.
This is the code I came up with:
stc("{MCompleted Mob Quests{m:{x\n\r", ch);
if (ch->quest_1)
sprintf (buf, "{D%s{x\n\r", finish_quest_bit (ch->quest_1));
send_to_char (buf, ch);

These are the errors I got:
act_info.c: In function do_qscore:
act_info.c:5054: warning: implicit declaration of function finish_quest_bit
act_info.c:5054: warning: format %s expects type char *, but argument 3 has type int

and this is what I got displayed on my mud
[Quest  Information]
* Points : 9985612 *
* Total : 6644 *
* Completed: 125 *
* Failed : 21 *
Completed Mob Quests:
Retrieve a Shovel For Gortado
Retrieve a Repair Hammer for Kyiaria

So far it hasn't caused any problems, although I do notice that it forces a random space on the second line, or it deletes the space from the first, not sure. So I was wondering, should I be prepared for some nasty bugs coming my way for cramming characters into what should be a numeric format?

Edit by kiasyn: Code formatting
31 Jan, 2010, Zeno wrote in the 2nd comment:
Votes: 0
Those aren't errors, those are warnings. Are you getting any actual errors?
31 Jan, 2010, Tyche wrote in the 3rd comment:
Votes: 0
finish_quest_bit() isn't declared before using it. The compiler assumes it returns an integer. printf() is mad because %s wants a char*.
01 Feb, 2010, triskaledia wrote in the 4th comment:
Votes: 0
I'm not getting any actual errors, just those warnings. Guess I worded it wrong. Shouldn't finish_quest_bit() be declared already since it's already defined over in handler.c, or do I have to include it into the void do_qscore(THE STUFF THAT GOES HERE)? I never really understood what all that stuff does inside of the ()'s after defining void name; aren't they just arguments that'll be used? That char printf is wanting is the definition of A/B/etc, I didn't want it to print out those because my players won't know what A/B/etc is. Should I be writing an if statement defining what A/B equals instead of just having it print inaccurate information into the "string call"?
01 Feb, 2010, Tyche wrote in the 5th comment:
Votes: 0
I'm thinking TutorialFunctionDeclarationsAndDefinitio... is exactly what you need to read. :-)
Random Picks