Jump to content
  • 0

Facing problem with the Coin to Cash exchanger NPC


ahloi007

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   1
  • Joined:  10/15/12
  • Last Seen:  

prontera,150,150,4	script	Converter	83,{
	.@name$ ="[^FF0000Cash Point Converter^000000]";

	mes .@name$;
	mes "Welcome, "+strcharinfo(0)+"!";
	mes "You currently have ^ff0000"+#CASHPOINTS+"^000000 Cash Points";
	next;

	mes .@name$;
	mes "How can I help you?";
	menu "Exchange Gold Coin to Cash Point", L_GTC, "Cancel", L_Cancel;

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

	input .@count;
	if (.@count == 0) close;
	if (countitem(7517) < .@count*30) goto L_Noitem;
	delitem 7517,.@count*30;
	set #CASHPOINTS, #CASHPOINTS + ( .@count*200 );

	close;


L_Noitem:

	next;
	mes .@name$;
	mes "Sorry you dont have enough of Gold Coin";
	close;

L_Cancel:
	mes .@name$;
	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
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  90
  • Reputation:   34
  • Joined:  10/01/18
  • Last Seen:  

8 hours ago, ahloi007 said:

prontera,150,150,4	script	Converter	83,{
	.@name$ ="[^FF0000Cash Point Converter^000000]";

	mes .@name$;
	mes "Welcome, "+strcharinfo(0)+"!";
	mes "You currently have ^ff0000"+#CASHPOINTS+"^000000 Cash Points";
	next;

	mes .@name$;
	mes "How can I help you?";
	menu "Exchange Gold Coin to Cash Point", L_GTC, "Cancel", L_Cancel;

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

	input .@count;
	if (.@count == 0) close;
	if (countitem(7517) < .@count*30) goto L_Noitem;
	delitem 7517,.@count*30;
	set #CASHPOINTS, #CASHPOINTS + ( .@count*200 );

	close;


L_Noitem:

	next;
	mes .@name$;
	mes "Sorry you dont have enough of Gold Coin";
	close;

L_Cancel:
	mes .@name$;
	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 .@name$ = "[ ^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 .@name$;
		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 .@amount;
		if( .@amount < .qty || .@amount > countitem(.itemID) ) {
			mes .@name$;
			mes "That's an Invalid amount.";
			mes "Please try again.";
			close;
		}
		mes .@name$;
		mes "Are you sure you want to exchange "+.@amount+" x ^0000FF"+.ItemName$+"^000000 to "+ .@amount * 5 +" ^FF0000Cash Points^000000?";
		next;
		if( select(" - Yes: - No") == 2 ) close;
			#CASHPOINTS = #CASHPOINTS + .@amount * 5 );
			mes .@name$;
			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, .@amount;
			dispbottom "Your new balance is now : "+ F_InsertComma(#CASHPOINTS) +" Cash Points";
			close;
	case 2:
		mes .@name$;
		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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   1
  • Joined:  10/15/12
  • Last Seen:  

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 .@name$ = "[ ^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 .@name$;
		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 .@amount;
		if( .@amount < 40 || .@amount > countitem(.itemID) ) {
			mes .@name$;
			mes "That's an Invalid amount.";
			mes "Please try again.";
			close;
		}
		mes .@name$;
		mes "Are you sure you want to exchange "+.@amount+" x ^0000FF"+.ItemName$+"^000000 to 200 ^FF0000Cash Points^000000?";
		next;
		if( select(" - Yes: - No") == 2 ) close;
			mes .@name$;
			mes "You have successfully exchanged "+ .ItemName$ +" to Cash Points.";
			mes "You have your new balance "+ F_InsertComma(#CASHPOINTS) +" ^FF0000Cash Points^000000.";
			delitem .itemID, .@amount;
			#CASHPOINTS = #CASHPOINTS + ( .@amount * 5 );
			dispbottom "Your new balance is now : "+ F_InsertComma(#CASHPOINTS) +" Cash Points";
			close;
	case 2:
		mes .@name$;
		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, .@amount 30;
#CASHPOINTS = #CASHPOINTS + ( .@amount 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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  90
  • Reputation:   34
  • Joined:  10/01/18
  • Last Seen:  

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, .@amount 30;

#CASHPOINTS = #CASHPOINTS + ( .@amount 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 + .@amount * 5 );
			mes .@name$;
			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, .@amount;
			dispbottom "Your new balance is now : "+ F_InsertComma(#CASHPOINTS) +" Cash Points";
			close;

 

Edited by Royr
  • Like 1
Link to comment
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.

×
×
  • Create New...