Jump to content

Utility: Coin for Coin Exchanger


Kido

Recommended Posts


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

File Name: Coin to Coin Exchanger 1.1
File Author: Kido
Date Released: 24/12/2013 (merry christmas!)
Category: Utility
Modified/Original Author: Not modified/Kido
 
Description:
Exchanges low value Coins for more valuable Coins, for example, Bronze Coins to Silver Coin.

 

TODO:

  1. Add colors
  2. Allow viceversa (for example, Silver Coins to Bronze Coins)

Suggestions (?)

 
How to change amounts:
Example, you want to make 1000 Bronze Coins = to 1 Silver Coin.
 
Change the 100 of the maxium amount to 1000

if(countitem(673)<100)goto no_item; //that 100, change it to 1000

Change the 100 of the deleting coin

delitem 673,1*@amount*100; //that 100, change it to 1000 

It should look like this:
 

case 1:
mes "Input the amount of desired Silver Coins.";
mes "Remember: 1000 Bronze Coin = 1 Silver Coin";
mes "I can exchange you a Maxium of: 100 of your desired coin.";
next;
if(countitem(673)<1000) {
mes "You don't have enought Coin to get the desired amount of coins that you specified.";
close;
}
else
{
input @amount,0,100;
delitem 673,1*@amount*1000;
getitem 675,1*@amount;
close;
} 

Remember to change Table of Values too :)
 

mes "1000 Bronze = 1 Silver"; //lol the first 100 now is a 1000
mes "100 Silver = 1 Gold";
mes "100 Gold = 1 Mithril";
mes "100 Mithril = 1 Platinum";
mes "100 Platinum = 1 Proof of Donation"; 

Well, i hope this script helps to anyone one day.
Any bug or question you may ask by just repplying to this topic, you can PM me too but i don't guarantee that i will answer fast, also if someone know how to fix/change something, that some can repply to this as an answer to you :)
 

(i know i'm not a good scripter but i just wanted to give this as a little gif to anyone who likes it or anyone who can give an use to it)


 
Merry xmas to all!

 

Changelog:

Coin to Coin Exchanger 1.1 Replaced Labels with Switch

Coin to Coin Exchanger 1.0 First release

Coin To Coin Exchanger 1.1 .txt

Edited by Kido
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   20
  • Joined:  02/05/13
  • Last Seen:  

Nice release    /thx

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

Nice release    /thx

 

You are welcome, i hope you find it useful :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

your blog catches my attention, so I like to comment on your 1st script xD

1st thing that comes to mind is that you need to learn proper indent

for example,

prontera,159,177,4	script	Exchange House	935,{
	mes "Table of values";
	mes "100 Bronze = 1 Silver";
	mes "100 Silver = 1 Gold";
	mes "100 Gold = 1 Mithril";
	mes "100 Mithril = 1 Platinum";
	mes "100 Platinum = 1 Proof of Donation";
	next;
	menu "Bronze to Silver",L_BS,"Silver to Gold",L_SG,"Gold to Mithril",L_GM,"Mithril to Platinum",L_MP,"Platinum to Proof of Don.",L_PP,"nothing, thank you anyway",L_ND;
	next;
L_ND:
	mes "Allright, if you need to get some coins come to me.";
	close;
no_item:
	mes "You don't have enought Coin to get the desired amount of coins that you specified.";
	close;
L_BS:
	if(countitem(673)<100)goto no_item;
	mes "Input the amount of desired Silver Coins.";
	mes "Remember: 100 Bronze Coin = 1 Silver Coin";
	mes "I can exchange you a Maxium of: 100 of your desired coin.";
	mes "I DO NOT DO REFUNDS, input the amount that correctly matches with your affordable desired coins that you want.";
	input @amount,0,100;
	delitem 673,1*@amount*100;
	getitem 675,1*@amount;
	close;
it may have not much affect in a simple script like this, but when you are trying to write a more advance scripts

without proper indent the script will look very horrible and harder to read

2nd thing comes to mind, try not to use so many labels

I can only rewrite your script to prove ya

//===== rAthena Script =======================================
//= Kido's First Scrip Release: Coin to Coin Exchanger
//===== By: ==================================================
//= 100% Kido
//===== YOU CAN NOT ==========================================
//= Remove the credits
//===== YOU CAN ==============================================
//= Improve it
//============================================================
prontera,159,177,4	script	Exchange House	935,{
	mes "choose ...";
	setarray .@coin, 673,675,671,674,677,7179;
	for ( .@i = 0; .@i < 5; .@i++ )
		.@menu$ = .@menu$ + getitemname( .@coin[.@i] ) +" -> "+ getitemname( .@coin[.@i +1] ) +":";
	next;
	.@s = select( .@menu$ ) -1;
	if ( countitem( .@coin[.@s] ) < 100 ) {
		mes "you don't have enough coin to get .... blah blah";
		close;
	}
	mes "input the amount of desired "+ getitemname( .@coin[.@s +1] );
	if ( input( .@amount, 1, 100 ) ) {
		mes "invalid range";
		close;
	}
	else if ( .@amount * 100 > countitem( .@coin[.@s] ) ) {
		mes "you don't have enough coins for it";
		close;
	}
	delitem .@coin[.@s], .@amount * 100;
	getitem .@coin[.@s +1], .@amount;
	close;
}
I'm not sure how many months until you are able to understand this kind of advance scripting technique

but as you can see, I didn't use a single label for it

so if you wanna become a great scripter, you should try to script without using *menu or *goto

and 3rd, your script has an exploit

1. @item 673 100 ... you get 100 bronze coin

2. asked to change bronze coin to silver coin

3. it ask for input how many you want to change, input 5

bam, error message

[Error]: script:delitem: failed to delete 500 items (AID=2000000 item_id=673).
[Debug]: Source (NPC): Exchange House at prontera (159,177)
you need to do a check for that, which you can check at mine
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

your blog catches my attention, so I like to comment on your 1st script xD

1st thing that comes to mind is that you need to learn proper indent

for example,

prontera,159,177,4	script	Exchange House	935,{
	mes "Table of values";
	mes "100 Bronze = 1 Silver";
	mes "100 Silver = 1 Gold";
	mes "100 Gold = 1 Mithril";
	mes "100 Mithril = 1 Platinum";
	mes "100 Platinum = 1 Proof of Donation";
	next;
	menu "Bronze to Silver",L_BS,"Silver to Gold",L_SG,"Gold to Mithril",L_GM,"Mithril to Platinum",L_MP,"Platinum to Proof of Don.",L_PP,"nothing, thank you anyway",L_ND;
	next;
L_ND:
	mes "Allright, if you need to get some coins come to me.";
	close;
no_item:
	mes "You don't have enought Coin to get the desired amount of coins that you specified.";
	close;
L_BS:
	if(countitem(673)<100)goto no_item;
	mes "Input the amount of desired Silver Coins.";
	mes "Remember: 100 Bronze Coin = 1 Silver Coin";
	mes "I can exchange you a Maxium of: 100 of your desired coin.";
	mes "I DO NOT DO REFUNDS, input the amount that correctly matches with your affordable desired coins that you want.";
	input @amount,0,100;
	delitem 673,1*@amount*100;
	getitem 675,1*@amount;
	close;
it may have not much affect in a simple script like this, but when you are trying to write a more advance scripts

without proper indent the script will look very horrible and harder to read

2nd thing comes to mind, try not to use so many labels

I can only rewrite your script to prove ya

//===== rAthena Script =======================================
//= Kido's First Scrip Release: Coin to Coin Exchanger
//===== By: ==================================================
//= 100% Kido
//===== YOU CAN NOT ==========================================
//= Remove the credits
//===== YOU CAN ==============================================
//= Improve it
//============================================================
prontera,159,177,4	script	Exchange House	935,{
	mes "choose ...";
	setarray .@coin, 673,675,671,674,677,7179;
	for ( .@i = 0; .@i < 5; .@i++ )
		.@menu$ = .@menu$ + getitemname( .@coin[.@i] ) +" -> "+ getitemname( .@coin[.@i +1] ) +":";
	next;
	.@s = select( .@menu$ ) -1;
	if ( countitem( .@coin[.@s] ) < 100 ) {
		mes "you don't have enough coin to get .... blah blah";
		close;
	}
	mes "input the amount of desired "+ getitemname( .@coin[.@s +1] );
	if ( input( .@amount, 1, 100 ) ) {
		mes "invalid range";
		close;
	}
	else if ( .@amount * 100 > countitem( .@coin[.@s] ) ) {
		mes "you don't have enough coins for it";
		close;
	}
	delitem .@coin[.@s], .@amount * 100;
	getitem .@coin[.@s +1], .@amount;
	close;
}
I'm not sure how many months until you are able to understand this kind of advance scripting technique

but as you can see, I didn't use a single label for it

so if you wanna become a great scripter, you should try to script without using *menu or *goto

and 3rd, your script has an exploit

1. @item 673 100 ... you get 100 bronze coin

2. asked to change bronze coin to silver coin

3. it ask for input how many you want to change, input 5

bam, error message

[Error]: script:delitem: failed to delete 500 items (AID=2000000 item_id=673).
[Debug]: Source (NPC): Exchange House at prontera (159,177)
you need to do a check for that, which you can check at mine

 

 

haha thank your replying me, since i readed that you like to criticize other scripts i was hoping you to repply so i can improve xD

 

 

may it will take me years to understand the whole scripting thing x_x but i find it funny and interesting to read o:

 

i only know that kind of menu, also know the " "switch( select("Cat1:Cat2:Cat3:Cat4") ){" " and the common labels D:!

 

huh how to fix that exploit ? because it's supposed not to happen DDDD:!

 

thanks i will try to improve it and update the post, will credit you :3

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

L_BS:

if(countitem(673)<100)goto no_item;

mes "Input the amount of desired Silver Coins.";

mes "Remember: 100 Bronze Coin = 1 Silver Coin";

mes "I can exchange you a Maxium of: 100 of your desired coin.";

mes "I DO NOT DO REFUNDS, input the amount that correctly matches with your affordable desired coins that you want.";

input @amount,0,100;

if ( @amount * 100 > countitem(673) ) goto input_too_high;

delitem 673,1*@amount*100;

getitem 675,1*@amount;

close;

no_item:

mes "You don't have enought Coin to get the desired amount of coins that you specified.";

close;

input_too_high:

mes "You can't input higher number than the coins you currently have !";

close;

something like this I guess
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

isn't there something like:

 

if input amount > 100 countitem(673) goto input_too_high;

 

?

 

i tryied but the npc stopped working D:!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

i tryied but the npc stopped working D:!

where is your edited script ? and the server error if you are getting any

though, if you want a support, should open a new topic in script support though

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

Updated 12/02/2014

 

 

i tryied but the npc stopped working D:!

where is your edited script ? and the server error if you are getting any

though, if you want a support, should open a new topic in script support though

 

 

yeah i will, also i will first add some colors and then try to add that part x_x because it stills show that thing of the exploit D:

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
Reply to this topic...

×   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...