RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Gold commands

Quantos

Lord
A_Li_N gave me permission to post this modification of her scripts. They are based on the optimized files that xxSpiderxx posted. The playergold.cs file will go through each character and list what amount of gold they have, and write it to a text file, that way you can reference it a little easier.

Revan has repaired this script. Please look to his post for the correction.
 
What would be pretty cool is if you said [worldgold it would make a log file (worldgold.txt) and in the log it would list all the gold in the world and every player in the game with how much total gold they have.
 

A_Li_N

Knight
SphericalSolaris said:
What would be pretty cool is if you said [worldgold it would make a log file (worldgold.txt) and in the log it would list all the gold in the world and every player in the game with how much total gold they have.
I think that's basically what Quantos has done. He made it write a txt file...I'm sure if you want a different format, you can easily change it in the script.
 

panther

Sorceror
I failed to notice the version by Quantos before I added commands to dump to a text file but I figured I'd share mine anyway since it's a little different. This one uses a single command "gold" with arguments: "players", "world", or "dump".
The dump version creates a file called gold.txt which lists each player and how much gold is in their bank or on their person, in tabbed format.
I also made both the players and dump versions include only access levels below GM in the player lists.

Thanks, A_Li_N!
 

Attachments

  • GoldList.cs
    4 KB · Views: 35

ditmar

Wanderer
Quantos said:
A_Li_N gave me permission to post this modification of her scripts. They are based on the optimized files that xxSpiderxx posted. The playergold.cs file will go through each character and list what amount of gold they have, and write it to a text file, that way you can reference it a little easier.

The txt file it generates adds up the gold for every player so it is not possible to see how much a player actually owns as it is his amount + the amount of all previous players in the list. Could you make it so it only displays the amount of the player itself?
 

A_Li_N

Knight
Yes you could most likely. But since this is not a request forum :D

Simply change when/how many times the script writes to the txt file and have it write each name out and the amount of gold
 

Quantos

Lord
ditmar said:
The txt file it generates adds up the gold for every player so it is not possible to see how much a player actually owns as it is his amount + the amount of all previous players in the list. Could you make it so it only displays the amount of the player itself?

No it doesn't, it lists what each player actually has.
 

mblicata

Wanderer
Hmm, Quantos I found an error your version of the playergold file. Now maybe this is only happening for staff chars, but I've found that it is adding the gold total in each account up for each player in the account, which makes more gold than there actually is. For example, I have two characters made in the same account on my test shard. One character has 1000 gold and the other has none. When I run the playergold command it counts the 1000 for the first char, and then counts the 1000 for the second char, stating that players own 2000 gold, when in reality there is only 1000. This would obviously make the player gold amounts seem much larger than they actually are, especially for those shards with rich players.
 

ditmar

Wanderer
Quantos said:
No it doesn't, it lists what each player actually has.

I can send u my text file, its impossible for 1 player to have 1173968000 GP I think. I'm not just saying things.
 

Quantos

Lord
ditmar said:
I can send u my text file, its impossible for 1 player to have 1173968000 GP I think. I'm not just saying things.

It's not impossible, but highly improbable, unless you run the easiest shard to get rich on :)

<edit> I did take another look at the script, you are correct, it does add it as it goes. I will make the changes and update the file that I posted. Thanks again for pointing that out to me.</edit>
 

ditmar

Wanderer
Quantos said:
It's not impossible, but highly improbable, unless you run the easiest shard to get rich on :)

<edit> I did take another look at the script, you are correct, it does add it as it goes. I will make the changes and update the file that I posted. Thanks again for pointing that out to me.</edit>

NP, please let me know when you have updated it!

Thanks.
 

Quantos

Lord
Actually it will be Revan that will fix it, he's a far better scriptor than I am. But yes, I will let you know when it's done.
 

rpggamer

Wanderer
hey

Hey all I like this script but im having a small problem, I wanted to post to see if anyone else is having this.

When I type in [worldgold it says there is 1.259 Million Gold in the world.
When I type in [playergold it says that these players have this amount of gold

Checking DAUO [1000]
Checking Ryan [1062000]

hehe there isnt even no character named Ryan in my world and DAUO is my admin character and he does not have 1000 gold anywhere, please tell me whats going on :) Thank You.
 

mblicata

Wanderer
Ryan = the Dev of RunUO, he had to leave his mobile in the world for some reason that I don't remember. Anyways, yeah, it's no threat or anything, you could delete him using Arya's worldspy script if you wanted.
 

Dracolique

Sorceror
Quantos, I was getting a null reference exception server crash when using your modification of the PlayerGold script, so I changed the following parts( hope you dont mind ), and now it works flawlessly:


Code:
public static float GoldOnPlayers( Mobile m )
		{
			float GoP = 0;

			using ( StreamWriter css = GetWriter( "docs/", "Player Gold.txt" ) )
			{
				foreach( Mobile MiW in World.Mobiles.Values )
				{
					if( MiW != null && MiW is PlayerMobile )
					{
						PlayerMobile pm = (PlayerMobile)MiW;
						if ( pm.BankBox != null && pm.Backpack != null )
						{
						GoP += SearchForGold( pm.BankBox );
						GoP += SearchForGold( pm.Backpack );
						m.SendMessage( "Checking " + pm.Name + " ("+GoP+")");
						css.WriteLine( pm.Name + " has "+GoP+" GP." );
						}
					}
				}
			}
			return GoP;
		}

		public static float SearchForGold( Container c )
		{
			float goldcount = 0;

			foreach( Item i in c.Items )
				if( i!= null && i is Container )
					goldcount += SearchForGold( (Container)i );
				else if( i!= null && i is Gold )
					goldcount += ((Gold)i).Amount;
				else if( i != null && i is BankCheck )
					goldcount += ((BankCheck)i).Worth;
			return goldcount;
		}
 

Quantos

Lord
I don't mind at all, it was Revan that initially did the changes to the script, I just posted it. As soon as our version is repaired Revan will repost it again for you.

<edit>Look below.</edit>
 
Top