Re: [NEWBIE] Gold

From: Klaus Myrseth (klaus.myrseth@infohwy.no)
Date: 11/10/98


> give 1k coins Joe
What i would do is parce the argument string on give and gold to extract the
ending of the number in the value be4 the atoi command in the give function.
and then case for the letter k m and after that do some math to calc the
value up to what the real value would be:

switch (ending)
{
  case 'k':
    multiplyer = 1000;      // For the thousand part
    break;
  case 'm:
    multiplyer = 1000000    // For the milion part
    break;
  default:
    multiplyer = 1;         // For no ending
}

value = number * multiplyer; // then value would hold the value you need to
give the gold away.

** ALL NAMES ARE COINSIDENTAL TO PROTECT THE INNOCENT (me, dont remember
what it was named) **

if you do this then a value of 1k should be parced down to ending == 'k/m',
number == 1
and value would get 1000 after the last computation (if the funtion dont
find a ending it would compute the number * 1)

Hope this will help (i havent put inn a parce function here, but i guess you
should be able to write that one by yourself :)

Caram - Implementor of The Home of The Vikings.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST