|
Tigger Novice
Joined: 07 Oct 2002 Posts: 46 Location: USA
|
Posted: Mon Oct 28, 2002 10:11 pm
adding commas |
I want to add commas to my gold dislpay
is there any easy way of switching mud display for what I want it to display (gold with out commas to gold with commas?)
to add the commas I am using this (it works good for me)
#VAR gplen %len( @gp)
#IF (@gplen = 4) {#VAR gp %insert( ",", @gp, 2)}
#IF (@gplen = 5) {#VAR gp %insert( ",", @gp, 3)}
#IF (@gplen = 6) {#VAR gp %insert( ",", @gp, 4)}
#IF (@gplen = 7) {#VAR gp %insert( ",", @gp, 2)}
#IF (@gplen = 7) {#VAR gp %insert( ",", @gp, 6)}
#IF (@gplen = 8) {#VAR gp %insert( ",", @gp, 3)}
#IF (@gplen = 8) {#VAR gp %insert( ",", @gp, 7)}
#IF (@gplen = 9) {#VAR gp %insert( ",", @gp, 4)}
#IF (@gplen = 9) {#VAR gp %insert( ",", @gp, 8)}
it's a varient of the adding commas to exp found on here (don't rember who posted it thow)
if anyone could please help me with text switching I would apperacate it....thanks in advance. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Oct 28, 2002 11:30 pm |
quote:
I want to add commas to my gold dislpay
is there any easy way of switching mud display for what I want it to display (gold with out commas to gold with commas?)
to add the commas I am using this (it works good for me)
#VAR gplen %len( @gp)
#IF (@gplen = 4) {#VAR gp %insert( ",", @gp, 2)}
#IF (@gplen = 5) {#VAR gp %insert( ",", @gp, 3)}
#IF (@gplen = 6) {#VAR gp %insert( ",", @gp, 4)}
#IF (@gplen = 7) {#VAR gp %insert( ",", @gp, 2)}
#IF (@gplen = 7) {#VAR gp %insert( ",", @gp, 6)}
#IF (@gplen = 8) {#VAR gp %insert( ",", @gp, 3)}
#IF (@gplen = 8) {#VAR gp %insert( ",", @gp, 7)}
#IF (@gplen = 9) {#VAR gp %insert( ",", @gp, 4)}
#IF (@gplen = 9) {#VAR gp %insert( ",", @gp, 8)}
it's a varient of the adding commas to exp found on here (don't rember who posted it thow)
if anyone could please help me with text switching I would apperacate it....thanks in advance.
How is the number sent to you? If you want to turn 100345 to 100,345 then all you need to do is capture the number to the variable and wherever you want to switch to the comma'd number you can simply use the %format() function:
%format("n",@gp)
If you are going in the reverse direction and the MUD is sending you 100,345, you can simply use the %replace() function:
%replace("@gp",",","")
li'l shmoe of Dragon's Gate MUD |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Oct 28, 2002 11:36 pm |
The exact usage on format to add commas would be:
%format("&1.0n",@gp) |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|