Jump to content
  • 0
Sign in to follow this  
ahloi007

Facing problem with the Coin to Cash exchanger NPC

Question

Posted (edited)
prontera,150,150,4	script	Converter	83,{
	[email protected]$ ="[^FF0000Cash Point Converter^000000]";

	mes [email protected]$;
	mes "Welcome, "+strcharinfo(0)+"!";
	mes "You currently have ^ff0000"+#CASHPOINTS+"^000000 Cash Points";
	next;

	mes [email protected]$;
	mes "How can I help you?";
	menu "Exchange Gold Coin to Cash Point", L_GTC, "Cancel", L_Cancel;

L_GTC:
	next;
	mes [email protected]$;
	mes "Gold Coin will ^ff0000NOT TO BE REFUND^000000 after converted to Cash Points.";
	mes "Please keep that in your mind";
	next;
	mes [email protected]$;
	mes "How many Gold Coin do you want to exchange?";
	mes "^ff0000Note^000000: 30 Gold Coin currently 200 Cash Point";

	input [email protected];
	if ([email protected] == 0) close;
	if (countitem(7517) < [email protected]*30) goto L_Noitem;
	delitem 7517,[email protected]*30;
	set #CASHPOINTS, #CASHPOINTS + ( [email protected]*200 );

	close;


L_Noitem:

	next;
	mes [email protected]$;
	mes "Sorry you dont have enough of Gold Coin";
	close;

L_Cancel:
	mes [email protected]$;
	mes "No problem, Come back again";
	close;

	end;

}

Hi rAthena, this is the NPC script that I refer from some where else(I forgot the scripter name***)

I try to make it like 30 Gold coins to 200 Cash points, but at the end it doesn't function well.

No cash obtain, even I have 30 Gold Coins for the exchange.

Anyone could guide me the way to solve this problem?

Addon:

How to show out the amount of cash points gained from and npc in the chat log?

Untitled.jpg.8c09a96e642b13fed1fe95d1ddc20b67.jpg

Thank you, and sorry for my bad english!

Edited by ahloi007

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Posted (edited)
8 hours ago, ahloi007 said:
prontera,150,150,4	script	Converter	83,{
	[email protected]$ ="[^FF0000Cash Point Converter^000000]";

	mes [email protected]$;
	mes "Welcome, "+strcharinfo(0)+"!";
	mes "You currently have ^ff0000"+#CASHPOINTS+"^000000 Cash Points";
	next;

	mes [email protected]$;
	mes "How can I help you?";
	menu "Exchange Gold Coin to Cash Point", L_GTC, "Cancel", L_Cancel;

L_GTC:
	next;
	mes [email protected]$;
	mes "Gold Coin will ^ff0000NOT TO BE REFUND^000000 after converted to Cash Points.";
	mes "Please keep that in your mind";
	next;
	mes [email protected]$;
	mes "How many Gold Coin do you want to exchange?";
	mes "^ff0000Note^000000: 30 Gold Coin currently 200 Cash Point";

	input [email protected];
	if ([email protected] == 0) close;
	if (countitem(7517) < [email protected]*30) goto L_Noitem;
	delitem 7517,[email protected]*30;
	set #CASHPOINTS, #CASHPOINTS + ( [email protected]*200 );

	close;


L_Noitem:

	next;
	mes [email protected]$;
	mes "Sorry you dont have enough of Gold Coin";
	close;

L_Cancel:
	mes [email protected]$;
	mes "No problem, Come back again";
	close;

	end;

}

Hi rAthena, this is the NPC script that I refer from some where else(I forgot the scripter name***)

I try to make it like 30 Gold coins to 200 Cash points, but at the end it doesn't function well.

No cash obtain, even I have 30 Gold Coins for the exchange.

Anyone could guide me the way to solve this problem?

Addon:

How to show out the amount of cash points gained from and npc in the chat log?

Untitled.jpg.8c09a96e642b13fed1fe95d1ddc20b67.jpg

Thank you, and sorry for my bad english!

Please try this:
 

// Scripted by : Royr
// Description : Simple Cash Converter
// Topic: https://rathena.org/board/topic/127558-facing-problem-with-the-coin-to-cash-exchanger-npc/
prontera.gat, 155, 100, 4	script	Cash Converter	4_M_01,{

	mes [email protected]$ = "[ ^FF0000Cash Point Converter^000000 ]";
	mes "Greetings! Player "+strcharinfo(0)+".";
	mes " ";
	mes "Total Balance: ^FF0000"+F_InsertComma(#CASHPOINTS)+"^000000 Cash Points";
	dispbottom "You have Total Balance of: ^FF0000"+F_InsertComma(#CASHPOINTS)+"^000000 Cash Points";
	next;
	switch( select( implode(.menu_options$, ":") ) ) {
	case 1:
		mes [email protected]$;
		mes "^0000FF"+.ItemName$+"^000000 will ^ff0000NOT TO BE REFUND^000000 after converted to ^FF0000Cash Points^000000.";
		mes "How many Gold Coin do you want to exchange?";
		mes " ";
		mes "^ff0000Note^000000: "+.qty+" x ^0000FF"+.ItemName$+"^000000 equivalent to 200 ^FF0000Cash Points^000000.";
		next;
		input [email protected];
		if( [email protected] < .qty || [email protected] > countitem(.itemID) ) {
			mes [email protected]$;
			mes "That's an Invalid amount.";
			mes "Please try again.";
			close;
		}
		mes [email protected]$;
		mes "Are you sure you want to exchange "[email protected]+" x ^0000FF"+.ItemName$+"^000000 to "+ [email protected] * 5 +" ^FF0000Cash Points^000000?";
		next;
		if( select(" - Yes: - No") == 2 ) close;
			#CASHPOINTS = #CASHPOINTS + [email protected] * 5 );
			mes [email protected]$;
			mes "You have successfully exchanged "+ .ItemName$ +" to Cash Points.";
			mes " ";
			mes "You have added your new balance "+ F_InsertComma(#CASHPOINTS) +" ^FF0000Cash Points^000000.";
			delitem .itemID, [email protected];
			dispbottom "Your new balance is now : "+ F_InsertComma(#CASHPOINTS) +" Cash Points";
			close;
	case 2:
		mes [email protected]$;
		mes "Alrighth then! You can come back anytime.";
		close;
	}

OnInit:
	.itemID = 7517;
	.qty = 40;
	.ItemName$ = getitemname(.itemID) +"";

	setarray .menu_options$[0],
	"- Exchange ^0000FF"+.ItemName$+"^000000 to ^FF0000Cash Points^000000",
	"- Cancel";
	end;
}

 

 

Edited by Royr
Added Attachement
  • Love 1

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
3 hours ago, Royr said:

Please try this:
 

// Scripted by : Royr
// Description : Simple Cash Converter
// Topic: https://rathena.org/board/topic/127558-facing-problem-with-the-coin-to-cash-exchanger-npc/
prontera.gat, 150, 150, 4	script	Cash Converter	4_M_01,{

	mes [email protected]$ = "[ ^FF0000Cash Point Converter^000000 ]";
	mes "Welcome! Player "+strcharinfo(0)+".";
	mes "Total Balance: ^FF0000"+F_InsertComma(#CASHPOINTS)+"^000000 Cash Points";
	dispbottom "You have Total Balance of: ^FF0000"+F_InsertComma(#CASHPOINTS)+"^000000 Cash Points";
	next;
	switch( select( implode(.menu_options$, ":") ) ) {
	case 1:
		mes [email protected]$;
		mes "^0000FF"+.ItemName$+"^000000 will ^ff0000NOT TO BE REFUND^000000 after converted to ^FF0000Cash Points^000000.";
		mes "How many Gold Coin do you want to exchange?";
		mes " ";
		mes "^ff0000Note^000000: "+.qty+" x ^0000FF"+.ItemName$+"^000000 equivalent to 200 ^FF0000Cash Points^000000.";
		next;
		input [email protected];
		if( [email protected] < 40 || [email protected] > countitem(.itemID) ) {
			mes [email protected]$;
			mes "That's an Invalid amount.";
			mes "Please try again.";
			close;
		}
		mes [email protected]$;
		mes "Are you sure you want to exchange "[email protected]+" x ^0000FF"+.ItemName$+"^000000 to 200 ^FF0000Cash Points^000000?";
		next;
		if( select(" - Yes: - No") == 2 ) close;
			mes [email protected]$;
			mes "You have successfully exchanged "+ .ItemName$ +" to Cash Points.";
			mes "You have your new balance "+ F_InsertComma(#CASHPOINTS) +" ^FF0000Cash Points^000000.";
			delitem .itemID, [email protected];
			#CASHPOINTS = #CASHPOINTS + ( [email protected] * 5 );
			dispbottom "Your new balance is now : "+ F_InsertComma(#CASHPOINTS) +" Cash Points";
			close;
	case 2:
		mes [email protected]$;
		mes "Alrighth then! You can come back anytime.";
		close;
	}

OnInit:
	.itemID = 7517;
	.qty = 40;
	.ItemName$ = getitemname(.itemID) +"";

	setarray .menu_options$[0],
	"- Exchange ^0000FF"+.ItemName$+"^000000 to ^FF0000Cash Points^000000",
	"- Cancel";
	end;
}

 

Cash_Converter.txt 1.9 kB · 0 downloads

Thanks for your reply @Royr

this is great!! I like it !

Very appreciated!!

Can I know is it possible to make it 30 Gold Coins = 200 Cash Points?

I found out the script format was like 40 Gold Coins x 5 cash points = 200 cash point, am I right?

Just wonder can it be like:

delitem .itemID, [email protected] 30;
#CASHPOINTS = #CASHPOINTS + ( [email protected] 200 );

Im trying to learn with the script, hope you don't mind what I am asking. xD

 

And I also found out there was an error on the new balance shown in the npc.

You can find out in the picture chatlog shown new balance was 1500 cash points. but the new balance in npc was shown out with 1300 cash points.

Untitled.jpg.c2c52257ca1b2acf325656f30e8e609d.jpg

Edited by ahloi007

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
2 hours ago, ahloi007 said:

Thanks for your reply @Royr

this is great!! I like it !

Very appreciated!!

Can I know is it possible to make it 30 Gold Coins = 200 Cash Points?

I found out the script format was like 40 Gold Coins x 5 cash points = 200 cash point, am I right?

Just wonder can it be like:

delitem .itemID, [email protected] 30;
#CASHPOINTS = #CASHPOINTS + ( [email protected] 200 );

Im trying to learn with the script, hope you don't mind what I am asking. xD

 

And I also found out there was an error on the new balance shown in the npc.

You can find out in the picture chatlog shown new balance was 1500 cash points. but the new balance in npc was shown out with 1300 cash points.

Untitled.jpg.c2c52257ca1b2acf325656f30e8e609d.jpg

 

It should finally worked now.

			#CASHPOINTS = #CASHPOINTS + [email protected] * 5 );
			mes [email protected]$;
			mes "You have successfully exchanged "+ .ItemName$ +" to Cash Points.";
			mes " ";
			mes "You have added your new balance "+ F_InsertComma(#CASHPOINTS) +" ^FF0000Cash Points^000000.";
			delitem .itemID, [email protected];
			dispbottom "Your new balance is now : "+ F_InsertComma(#CASHPOINTS) +" Cash Points";
			close;

 

Edited by Royr
  • Like 1

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.