I wrote the following 29 lines of code inplace of do_gold. Basicly what it does is spilts your coinage into 3 diffrent units and desplays it that way. What i want to do is make it so whever you see gold in units it goes this way. What this means is i have to change a LOT of code and i dont want to have to put this in every place. What i am woundering is can i set this up so i can do somthing like, sprintf(buf, "That will be %s", GET_SPLITGOLD(amount) and have GET_SPLITGOLD take a number of normal coins and output a the results of this in a string. Any ideas? P.s. Sorry bout the code but last time no one gave me a real anwser cuz i dont think they understood what i was going. ALSO i WOULD like to make it so there are 10 copper in a silver, 20 silver in a gold. Right now its 10, 10.. Any ideas how i could modify the first 3 lines to acheve that? int cgold=GET_GOLD(ch)/100; int csilver=(GET_GOLD(ch)%100)/10; int ccopper=GET_GOLD(ch)%10; if (GET_GOLD(ch) == 0) send_to_char("You're broke!\r\n", ch); else if (GET_GOLD(ch) == 1) send_to_char("You have one miserable copper penny", ch); else { sprintf(buf, "You have "); if (cgold > 1) sprintf(buf, "%s%d gold coins", buf,cgold); if (cgold == 1) sprintf(buf, "%s1 gold coin", buf, cgold); if (cgold > 0 && csilver > 0) sprintf(buf, "%s, ", buf) if (csilver > 1){ sprintf(buf, "%s%d silver pennies", csilver); if (csilver == 1) sprintf(buf, "%s1 silver pennie", buf); if (cgold > 0 || csilver > 0) sprintf(buf, "%s and ", buf) if (ccopper == 0) sprintf(buf, "%s.\r\n", buf) if (ccopper >1) sprintf(buf, "%s %d copper pennies. \r\n",buf, ccopper); if (ccoper = 1) sprintf(buf, "%s 1 copper penny.\r\n",buf) send_to_char(buf,ch); }
This archive was generated by hypermail 2b30 : 12/07/00 PST