Jump to content
  • 0
Dolphin86

Exchange Script Not Working

Question

As title, i was trying to make player have an option how many item can he exchange, but some what i keep failing, please help?

the idea was below:

Spoiler

 

100 Stone Fragment (ID: 6078) exchange for 1 Rough Elunium (ID: 757)

100 Stone Fragment (ID: 6078) exchange for 1 Rough Oridecon (ID: 756)

15 Rough Elunium (ID: 757) exchange for 1 Elunium (ID: 985)

15 Rough Oridecon (ID: 756) exchange for 1 Oridecon (ID: 984)

 

 

Exchange Script:

Spoiler
neko_isle,73,118,4	script	Exchanger Board	4_BOARD3,{
setarray .@item, 6078,6078,757,756;
setarray .@sellrate, 100,100,15,15;
setarray .@exchange, 757,756,985,984; 
setarray .@amount, 1,1,1,1;

	.@menu = select( 
		(countitem(6078)?"100x "+getitemname(6078)+" to 1x "+getitemname(757)+"":""),
		(countitem(6078)?"- Exchange with "+getitemname(6078)+"":""),
		(countitem(757)?"- Exchange with "+getitemname(757)+"":""),
		(countitem(756)?"- Exchange with "+getitemname(756)+"":""),
		"- Nothing"
		);
		
	switch(.@menu) {
		case 1:
			.@amount = countitem( .@item[choice] ) / 100;
			.@getitem = countitem( .@exchange[choice] ) / .@amount;
			.@divided = .@amount / .@exchange;
			mes "You can exchange a total of "+ .@getitem +".";
			getitem .@exchange[choice],( .@getitem );
			delitem .@item[choice],( .@amount );
		break;
		
		case 2:
			set .choice, 1;
			delitem .@item[1],.@sellrate[.choice];
			getitem .@exchange[.choice],.@amount[.choice];
		break;
		
		case 3:
			set .choice, 2;
			delitem .@item[2],.@sellrate[.choice];
			getitem .@exchange[.choice],.@amount[.choice];
		break;
		
		case 4:
			set .choice, 2;
			delitem .@item[3],.@sellrate[.choice];
			getitem .@exchange[.choice],.@amount[.choice];
		break;
		
	default:
		mes "[ Exchanger ]";
		mes "There's nothing i can do for you.";
		mes " ";
		mes "Please come back to me later!";
		break;
	}
	end;

}

 

 

i was only focus on case 1, since i got stuck there on other case would have same result?

 

Edited by Dolphin86
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
8 hours ago, Dolphin86 said:

As title, i was trying to make player have an option how many item can he exchange, but some what i keep failing, please help?

the idea was below:

  Hide contents

 

100 Stone Fragment (ID: 6078) exchange for 1 Rough Elunium (ID: 757)

100 Stone Fragment (ID: 6078) exchange for 1 Rough Oridecon (ID: 756)

15 Rough Elunium (ID: 757) exchange for 1 Elunium (ID: 985)

15 Rough Oridecon (ID: 756) exchange for 1 Oridecon (ID: 984)

 

 

Exchange Script:

  Hide contents
neko_isle,73,118,4	script	Exchanger Board	4_BOARD3,{
setarray .@item, 6078,6078,757,756;
setarray .@sellrate, 100,100,15,15;
setarray .@exchange, 757,756,985,984; 
setarray .@amount, 1,1,1,1;

	.@menu = select( 
		(countitem(6078)?"100x "+getitemname(6078)+" to 1x "+getitemname(757)+"":""),
		(countitem(6078)?"- Exchange with "+getitemname(6078)+"":""),
		(countitem(757)?"- Exchange with "+getitemname(757)+"":""),
		(countitem(756)?"- Exchange with "+getitemname(756)+"":""),
		"- Nothing"
		);
		
	switch(.@menu) {
		case 1:
			.@amount = countitem( .@item[choice] ) / 100;
			.@getitem = countitem( .@exchange[choice] ) / .@amount;
			.@divided = .@amount / .@exchange;
			mes "You can exchange a total of "+ .@getitem +".";
			getitem .@exchange[choice],( .@getitem );
			delitem .@item[choice],( .@amount );
		break;
		
		case 2:
			set .choice, 1;
			delitem .@item[1],.@sellrate[.choice];
			getitem .@exchange[.choice],.@amount[.choice];
		break;
		
		case 3:
			set .choice, 2;
			delitem .@item[2],.@sellrate[.choice];
			getitem .@exchange[.choice],.@amount[.choice];
		break;
		
		case 4:
			set .choice, 2;
			delitem .@item[3],.@sellrate[.choice];
			getitem .@exchange[.choice],.@amount[.choice];
		break;
		
	default:
		mes "[ Exchanger ]";
		mes "There's nothing i can do for you.";
		mes " ";
		mes "Please come back to me later!";
		break;
	}
	end;

}

 

 

i was only focus on case 1, since i got stuck there on other case would have same result?

 

You can use this file

aaaa.txt

Edited by Slammer
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...

Important Information

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