Welcome to the Builder Academy

Question Rip/kill counter dont save need help please

More
26 May 2013 14:10 - 26 May 2013 14:19 #2689 by JTP
This is way over my skill level :/
The only other thing i found that i didnt add yet in plrtoascii.c is:

if (player.height != PFDEF_HEIGHT)
fprintf(outfile, "Hite: %d\n", (int)player.height);
if (player.weight != PFDEF_WEIGHT)
fprintf(outfile, "Wate: %d\n", (int)player.weight);

so i would need:

if (player_specials->saved.rip_cnt != PFDEF_RIPCNT)
fprintf(outfile, "died %d\n", (int)player_specials->saved.rip_cnt);
if (player_specials->saved.kill_cnt != PFDEF_KILLCNT)
fprintf(outfile, "killed %d\n", (int)player_specials->saved.kill_cnt);

Looks right ?

And is more needed ?

Help, ideas needed please.
Last edit: 26 May 2013 14:19 by JTP.

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

More
26 May 2013 14:28 #2690 by JTP
Just noticed that player_specials->saved.questpoints gets saved by not having to do with:

plrtoascii.c

__

pfdefaults.h

__

players.c

Are Things saved in different ways ?

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

More
26 May 2013 17:26 - 26 May 2013 18:04 #2696 by JTP
Just added to the:
Code:
plrtoascii.c changed a int spare to int rip_cnt and another to kill_cnt also added: if (psds->rip_cnt != PFDEF_RIPCNT) fprintf(outfile, "Ripcnt: %d\n", (int)psds->rip_cnt); if (psds->kill_cnt != PFDEF_KILLCNT) fprintf(outfile, "Killcnt: %d\n", (int)psds->kill_cnt); __ pfdefaults.h added: #define PFDEF_RIPCNT 0 #define PFDEF_KILLCNT 0 __ players.c added: GET_RIP_CNT(ch) = PFDEF_RIPCNT; GET_KILL_CNT(ch) = PFDEF_KILLCNT; Under case 'R' else if (!strcmp(tag, "Ripcnt")) GET_RIP_CNT(ch) = atoi(line); Under case 'K' else if (!strcmp(tag, "Killcnt")) GET_KILL_CNT(ch) = atoi(line); Further Down: if (GET_RIP_CNT(ch) != PFDEF_RIPCNT) fprintf(fl, Ripcnt: %d\n", GET_RIP_CNT(ch)); if (GET_KILL_CNT(ch) != PFDEF_KILLCNT) fprintf(fl, Killcnt: %d\n", GET_KILL_CNT(ch));
.

to match how it saved questpoints, and the others, but it still dont save :(
Last edit: 26 May 2013 18:04 by JTP.

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

More
26 May 2013 23:06 #2705 by Vatiken
C MUD Programming 101
Basic Understands of Grep
Basic C Programming
Basic GDB Debugger Usage

The majority of your troubles seem to come from a lack of a basic knowledge of C software development. If this is "over your skill level", then you should address that by looking into some of the links I provided. I enjoy helping out the community here to deal with bugs and issues in their projects but I won't be putting in more effort then the developer I'm trying to help.

Adding something new to a character in 99% of cases, is about as basic as it comes when adding to the code. All one needs to do is find a similar data type in the char_data file and duplicate it's entries in the code.

In your case you are adding an extra (int)eger data type, so just search the code for another saved (int) found in the char_data such as "int bank_gold;".
Code:
joseph@joseph-AOA150:~/Code/tbaGIT/tbamud/src$ grep 'bank_gold' *.c ****************************************************************** NO OCCURRENCES IN ANY OF THE C FILES joseph@joseph-AOA150:~/Code/tbaGIT/tbamud/src$ grep 'bank_gold' *.h structs.h: int bank_gold; /**< Gold the char has in a bank account */ utils.h:#define GET_BANK_GOLD(ch) ((ch)->points.bank_gold) ****************************************************************** TWO OCCURRENCES, INCLUDING A #DEFINE joseph@joseph-AOA150:~/Code/tbaGIT/tbamud/src$ grep 'GET_BANK_GOLD' *.c act.wizard.c: GET_GOLD(k), GET_BANK_GOLD(k), GET_GOLD(k) + GET_BANK_GOLD(k)); act.wizard.c: GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict), act.wizard.c: GET_BANK_GOLD(vict) = RANGE(0, 100000000); limits.c: curr_bank = GET_BANK_GOLD(ch); limits.c: GET_BANK_GOLD(ch) = MAX(0, curr_bank+amt); limits.c: if (GET_BANK_GOLD(ch) > curr_bank) GET_BANK_GOLD(ch) = 0; limits.c: GET_BANK_GOLD(ch) = MIN(MAX_BANK, curr_bank+amt); limits.c: if (GET_BANK_GOLD(ch) < curr_bank) GET_BANK_GOLD(ch) = MAX_BANK; limits.c: if (GET_BANK_GOLD(ch) == MAX_BANK) limits.c: return (GET_BANK_GOLD(ch)); limits.c: return (GET_BANK_GOLD(ch)); objsave.c: if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { objsave.c: while ((cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) && ch->carrying) { objsave.c: GET_BANK_GOLD(ch), objsave.c: rent_deadline = ((GET_GOLD(ch) + GET_BANK_GOLD(ch)) / cost); objsave.c: if (totalcost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { objsave.c: if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { objsave.c: GET_NAME(ch), cost, GET_GOLD(ch) + GET_BANK_GOLD(ch)); objsave.c: if (cost > (unsigned int)GET_GOLD(ch) + (unsigned int)GET_BANK_GOLD(ch)) { objsave.c: GET_BANK_GOLD(ch) -= MAX(cost - GET_GOLD(ch), 0); players.c: GET_BANK_GOLD(ch) = PFDEF_BANK; players.c: else if (!strcmp(tag, "Bank")) GET_BANK_GOLD(ch) = atoi(line); players.c: if (GET_BANK_GOLD(ch) != PFDEF_BANK) fprintf(fl, "Bank: %d\n", GET_BANK_GOLD(ch)); spec_procs.c: if (GET_BANK_GOLD(ch) > 0) spec_procs.c: send_to_char(ch, "Your current balance is %d coins.\r\n", GET_BANK_GOLD(ch)); spec_procs.c: if (GET_BANK_GOLD(ch) < amount) { ****************************************************************** NOW JUST WEED OUT THE SAVE/LOAD/STORE FUNCTIONALITY

Code:
****************************************************************** AND I DID IT FOR YOU. players.c: GET_BANK_GOLD(ch) = PFDEF_BANK; players.c: else if (!strcmp(tag, "Bank")) GET_BANK_GOLD(ch) = atoi(line); players.c: if (GET_BANK_GOLD(ch) != PFDEF_BANK) fprintf(fl, "Bank: %d\n", GET_BANK_GOLD(ch));

And plrtoascii.c is another program used to convert the old binary pfiles into c pfiles when circle made the switch, it is obsolete and unnecessary.

tbaMUD developer/programmer
The following user(s) said Thank You: Maximus

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

Time to create page: 0.196 seconds