[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  gah...Currency problem

gah...Currency problem

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Tue 01 Jun 2004 05:04 AM (UTC)
Message
i just spent my whole day putting in a currency snippet. right now, it's working, but everything but the gold is going to inventory. the snippet is for gold silver copper. i also put in platinum. i changed the system to look like this:

10 gold = 1 plat
10 silver = 1 gold
10 copper = 1 silver

whenever i give a mob 20 copper, i'll kill it, get the 20 copper, it won't go to score, but it'll go to my inventory. also, whenever i give the mob platinum, it comes back as copper when i get it from corpse. so if a mob has 20 plat on him, when i kill it i get 20 copper back and it's in my inventory as 20 copper. copper in my score doesn't change.

i'll post some code later, just wondered if anyone had this happen to them as well.

i have no idea, what's goin on. i'm looking through all my steps again. but it's so tedious and late at night. i'll try to put some code up soon.
[Go to top] top

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #1 on Tue 01 Jun 2004 06:02 AM (UTC)
Message
ok, for the most part, i have it working. but the platinum is still converting to copper. so i'm gonna look some more on that. i guessed i messed up somewhere in that tonage of code. heh.


i had just forgot to put the copper as type copper etc.
[Go to top] top

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #2 on Tue 01 Jun 2004 06:14 AM (UTC)
Message
here might be my problem:


/*
 * make some coinage
 * G/S/C support -Druid
 * type:
 * 0 = gold
 * 1 = silver
 * 2 = copper
 * 3 = platinum
 */
OBJ_DATA *create_money( int amount, int type )
{
    char buf[MAX_STRING_LENGTH];
    OBJ_DATA *obj;

    if ( amount <= 0 )
    {
	bug( "Create_money: zero or negative money %d.", amount );
	amount = 1;
    }
    
    if( type>4 || type<0)
    {
    	bug("Create_money: wrong type: %d!",type);
    	type=2;
    }

	if (type ==0)
	{
    	if ( amount == 1 )
    	{
		obj = create_object( get_obj_index( OBJ_VNUM_GOLD_ONE ), 0 );
		return obj;
    	}
    	else
    	{
		obj = create_object( get_obj_index( OBJ_VNUM_GOLD_SOME ), 0 );	
		sprintf( buf, obj->short_descr, amount );
		STRFREE( obj->short_descr );
		obj->short_descr = STRALLOC( buf );
		obj->value[0]	 = amount;
		return obj;
    	}
	}
	
	if (type ==1)
	{
    	if ( amount == 1 )
    	{
		obj = create_object( get_obj_index( OBJ_VNUM_SILVER_ONE ), 0 );
		return obj;
    	}
    	else
    	{
		obj = create_object( get_obj_index( OBJ_VNUM_SILVER_SOME ), 0 );	
		sprintf( buf, obj->short_descr, amount );
		STRFREE( obj->short_descr );
		obj->short_descr = STRALLOC( buf );
		obj->value[0]	 = amount;
		return obj;
    	}
	}
	
	if (type == 2)
	{
    	if ( amount == 1 )
   	 {
		obj = create_object( get_obj_index( OBJ_VNUM_COPPER_ONE ), 0 );
		return obj;
    	}
    	else
    	{
		obj = create_object( get_obj_index( OBJ_VNUM_COPPER_SOME ), 0 );	
		sprintf( buf, obj->short_descr, amount );
		STRFREE( obj->short_descr );
		obj->short_descr = STRALLOC( buf );
		obj->value[0]	 = amount;
		return obj;
    	}
	}
	if (type == 3)
	{
    	if ( amount == 1 )
   	 {
		obj = create_object( get_obj_index( OBJ_VNUM_PLATINUM_ONE ), 0 );
		return obj;
    	}
    	else
    	{
		obj = create_object( get_obj_index( OBJ_VNUM_PLATINUM_SOME ), 0 );	
		sprintf( buf, obj->short_descr, amount );
		STRFREE( obj->short_descr );
		obj->short_descr = STRALLOC( buf );
		obj->value[0]	 = amount;
		return obj;
    	}
	}
	obj = create_object( get_obj_index(  OBJ_VNUM_COPPER_ONE ), 0 ); <-----this might be?
	return obj;    
}



i'll go tinker with it
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #3 on Tue 01 Jun 2004 07:44 AM (UTC)
Message
I think we had this exact problem with that same snippet a few months back, search in the forums, I'm sure we figured it out before.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #4 on Tue 01 Jun 2004 08:15 AM (UTC)
Message
i have already searched the forums. the message that toy had awhile back was for a command for his bankers. which i'll implement that final code once i get this taken care of.

the only problem is, that platinum is converting to copper and i can't seem to find it anywhere.
[Go to top] top

Posted by Ithildin   USA  (262 posts)  [Biography] bio
Date Reply #5 on Tue 01 Jun 2004 08:46 AM (UTC)
Message
i found it...gah. this took too long..heh.

now on to putting in toy's code. ;)
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,024 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]