Jump to content
  • 0

Display input to a format


Question

Posted


Can you help me with message display or announce display format?

Thank you

mes "How much do you buy it?";

input .@price;

next;

mes "Buying Price: ^FF0000"+.@price+"^000000z";

// sample: if i input: 1000000

// This will display:

// Buying Price: 1000000z

// How can i make it to this format:

// Buying Price: 1m

// Buying Price: 1.1m

// Buying Price: 600k

// Buying Price: 1,000,000z

1 answer to this question

Recommended Posts

Posted

npc/other/Global_Functions.txt

//////////////////////////////////////////////////////////////////////////////////
// Returns a number with commas between every three digits.
// -- callfunc "F_InsertComma",<number>
// Examples:
//    callfunc("F_InsertComma",7777777)  // returns "7,777,777"
//////////////////////////////////////////////////////////////////////////////////
function	script	F_InsertComma	{
	set .@str$, getarg(0);
	for (set .@i,getstrlen(.@str$)-3; .@i>0; set .@i,.@i-3)
		set .@str$, insertchar(.@str$,",",.@i);
	return .@str$;
}

use this.

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...