28 Apr, 2015, capntroz wrote in the 1st comment:
Votes: 0
ok so looked at some snippets and picked a couple parts i liked or did not like and mashed em together and it compiles and works except for i get this error when compiling. roughly anywayz.

act.informative.c 1435:3 warning format expects argument of type int but argument 4 has type size
level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1);

wth . i hate being a noob. :(
28 Apr, 2015, capntroz wrote in the 2nd comment:
Votes: 0
this is stock and i didnt change it and as far as i know it was just being called/ran so it could display it as part of the score command to display hp/str/dex and all that.
28 Apr, 2015, capntroz wrote in the 3rd comment:
Votes: 0
this is the stock code that the error refers too.



ACMD(do_levels)
{
char buf[MAX_STRING_LENGTH];
size_t i, len = 0;
int nlen;

if (IS_NPC(ch)) {
send_to_char(ch, "You ain't nothin' but a hound-dog.\r\n");




return;
}

for (i = 1; i < LVL_IMMORT; i++) {
nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d-%-8d : ", i,
level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1);
if (len + nlen >= sizeof(buf) || nlen < 0)
break;
len += nlen;
28 Apr, 2015, capntroz wrote in the 4th comment:
Votes: 0
and this is the non affects part of the score command



ACMD(do_score)
{

/* SNIPPET MADE BY CORBYN
silverdagger.mine.nu:4000 */

struct time_info_data playing_time;

if (IS_NPC(ch))
return;

send_to_char(ch, "Name: %s %s.\r\n", GET_NAME(ch), GET_TITLE(ch));
send_to_char(ch, "Level: %d \r\n", GET_LEVEL(ch));
send_to_char(ch, "Align: %d \r\n", GET_ALIGNMENT(ch));
send_to_char(ch, "AC: %d/10 Age: %d\r\n", compute_armor_class(ch), GET_AGE(ch));

switch (GET_SEX(ch)) {
case SEX_MALE: send_to_char(ch, "Sex: Male\r\n"); break;
case SEX_FEMALE: send_to_char(ch, "Sex: Female\r\n"); break;
default: send_to_char(ch, "Sex: Neutral\r\n"); break;
}

playing_time = *real_time_passed((time(0) - ch->player.time.logon) + ch->player.time.played, 0);
send_to_char(ch, "You have been playing for %d day%s and %d hour%s.\r\n",
playing_time.day, playing_time.day == 1 ? "" : "s",
playing_time.hours, playing_time.hours == 1 ? "" : "s");

send_to_char(ch, "—————————————————————–\r\n");

send_to_char(ch, "Str: %d(%d) | Hit: %d(%d) —> Hit Gain: %d\r\n", GET_STR(ch), GET_ADD(ch), GET_HIT(ch), GET_MAX_HIT(ch), hit_gain(ch));
send_to_char(ch, "Int: %d | Mana: %d(%d) —> Mana Gain: %d\r\n", GET_INT(ch), GET_MANA(ch), GET_MAX_MANA(ch), mana_gain(ch));
send_to_char(ch, "Wis: %d | Move: %d(%d) —> Move Gain: %d\r\n", GET_WIS(ch), GET_MOVE(ch), GET_MAX_MOVE(ch), move_gain(ch));
send_to_char(ch, "Con: %d | \r\n", GET_CON(ch));
send_to_char(ch, "Dex: %d | \r\n", GET_DEX(ch));
send_to_char(ch, "Cha: %d | Gold: %d\r\n", GET_CHA(ch), GET_GOLD(ch));

send_to_char(ch, "—————————————————————–\r\n");

send_to_char(ch, "EXP Gained %d\r\n", GET_EXP(ch));
if (GET_LEVEL(ch) < LVL_IMMORT)
send_to_char(ch, "EXP Left %d\r\n", level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch));
28 Apr, 2015, Tyche wrote in the 5th comment:
Votes: 0
It's warning you that i should be type int, not size_t.

See the definition above.
>>>> size_t i, len = 0;
28 Apr, 2015, capntroz wrote in the 6th comment:
Votes: 0
ahhh ok dont i feel like a idiot. took 3 seconds to fix. thanks works perfect now till i wanna tweek it to be more personalized. but at least the basics are there.
28 Apr, 2015, SlySven wrote in the 7th comment:
Votes: 0
In more mature C code you may well encounter code that uses integer types as indexes into arrays whereas later code will use the proper, unsigned size_t type (and the signed ptrdiff_t for results of maths on such values where a negative result is possible) for such things - obviously this is more likely if you are home-brewing code with, um, multiple parents / libraries…!
28 Apr, 2015, capntroz wrote in the 8th comment:
Votes: 0
ohhh i used to hate arrays in pascal…. took me forever to get it. but in the little time ive been messing with my mud i have learned a good bit. cant wait to learn more.
28 Apr, 2015, quixadhal wrote in the 9th comment:
Votes: 0
I remember lots of people having trouble with the concept of a pointer in pascal class (first computer science class in college, back in the Jurrasic era). I couldn't understand why it seemed so complicated to people, but that's because I learned assembly language first. :)
28 Apr, 2015, capntroz wrote in the 10th comment:
Votes: 0
yeh it was a pain. why i went to writing stuff in qbasic/basica for awhile. heard darkbasic is cool with directx support. but for a good while im working on me mud. starting to know where some things are in the code but barely know how to code in c tho some stuff i get from past experience coding. currently im trying to make it start the charecter of with either a bag of a couple items/20-30 gold for food or a set of eq for each class. found where the new charecter creation is located but im not near ready to try and code something from scratch tho it may be simple. at least i know where im doing it now tho when the time comes.
0.0/10