• 0
Sign in to follow this  
rochenel27

Scripting Error

Question

Hi guys! I'm a newbie in scripting. Just started learning today and just need your help on what's wrong with this script that I made?
I would really appreciate if you'll pin point my mistakes so that I will learn. Thank you!

 

// Item Trader

prontera,147,170,4	script Item Trader	622,{
	mes "[Item Trader]";
	mes "Hi! How can I help you?";
	mes "Item Ticket = 100 Yggdrasil Berry";
	mes "Item Ticket = 30 Poison Bottles";
	menu "Item Ticket to Yggdrasil Berry", C_1, "Item Ticket to Poison Bottle", C_2, "Yggdrasil Berry to Item Ticket", C_3, "Poison Bottle to Item Ticket" C_4;
	
C_1:
	if (checkweight(607,100) == 0 ) goto C_OW;
	if(countitem(7284)<1) goto C_NI;
	delitem 7284,1;
	getitem 607,100;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_2:
	if (checkweight(678,30) == 0 ) goto L_OW;
	if(countitem(7284)<1) goto C_NI;
	delitem 7284,1;
	getitem 678,300;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_3:
	if(countitem(607)<100) goto C_NI;
	delitem 607,100;
	getitem 7284,1;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_4:
	if(countitem(678)<30) goto C_NI;
	delitem 678,30;
	getitem 7284,1;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_OW
	mes "[Item Trader]";
	mes "Sorry you're overweight";
	close;
	
		
C_NI:
	mes "[Item Trader]";
	mes "[You don't have the items]";
	close;
}

 

  • Love 1

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1
3 hours ago, rochenel27 said:

Hi guys! I'm a newbie in scripting. Just started learning today and just need your help on what's wrong with this script that I made?
I would really appreciate if you'll pin point my mistakes so that I will learn. Thank you!

 

// Item Trader

prontera,147,170,4	script Item Trader	622,{
	mes "[Item Trader]";
	mes "Hi! How can I help you?";
	mes "Item Ticket = 100 Yggdrasil Berry";
	mes "Item Ticket = 30 Poison Bottles";
	menu "Item Ticket to Yggdrasil Berry", C_1, "Item Ticket to Poison Bottle", C_2, "Yggdrasil Berry to Item Ticket", C_3, "Poison Bottle to Item Ticket" C_4;
	
C_1:
	if (checkweight(607,100) == 0 ) goto C_OW;
	if(countitem(7284)<1) goto C_NI;
	delitem 7284,1;
	getitem 607,100;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_2:
	if (checkweight(678,30) == 0 ) goto L_OW;
	if(countitem(7284)<1) goto C_NI;
	delitem 7284,1;
	getitem 678,300;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_3:
	if(countitem(607)<100) goto C_NI;
	delitem 607,100;
	getitem 7284,1;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_4:
	if(countitem(678)<30) goto C_NI;
	delitem 678,30;
	getitem 7284,1;
	mes "[Item Trader]";
	mes "[There you go!]";
	close;
	
C_OW
	mes "[Item Trader]";
	mes "Sorry you're overweight";
	close;
	
		
C_NI:
	mes "[Item Trader]";
	mes "[You don't have the items]";
	close;
}

 

You had an extra TAB in prontera,147,170,4 and you miss in "Poison Bottle to Item Ticket" C_4; and should be "Poison Bottle to item Ticket",C_4; C_OW you miss put 

Btw, i recommend you use switch(select in menu tab, is more easy to use and less tedious. I made an example script to help you:

prontera,150,171,4	script	Item Trader	622,{
	disable_items;
  	disable_command;
	mes "[^711872Trader^000000]";
	mes "Hello hello Hello!";
	switch(select("Item Ticket to Yggdrasil Berry:Item Ticket to Poison Bottle:Yggdrasil Berry to Item Ticket:Poison Bottle to Item Ticket:- Close.")) {
	
	case 1:
		if (checkweight(607,100) == 0 ) goto C_OW;
		if(countitem(7284)<1) goto C_NI;
		delitem 7284,1;
		getitem 607,100;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
	
	case 2:
		if (checkweight(678,30) == 0 ) goto L_OW;
		if(countitem(7284)<1) goto C_NI;
		delitem 7284,1;
		getitem 678,300;
		next;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
	
	case 3:
		next;
		if(countitem(607)<100) goto C_NI;
		delitem 607,100;
		getitem 7284,1;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
	
	case 4:
		next;
		if(countitem(678)<30) goto C_NI;
		delitem 678,30;
		getitem 7284,1;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
		
	case 5:
		next;
		mes "[^711872Trader^000000]";
		mes "See ya!";
		close;
	
	C_OW:
		next;
		mes "[^711872Trader^000000]";
		mes "Sorry you're overweight";
		close;
	
		
	C_NI:
		next;
		mes "[^711872Trader^000000]";
		mes "[You don't have the items]";
		close;

	}
}

I recommend you use disable_items; and disable_command; to prevent exploits. hope it helped you. 😄

Edited by EIysium

Share this post


Link to post
Share on other sites
  • 0
5 minutes ago, EIysium said:

You had an extra TAB in prontera,147,170,4 and you miss in "Poison Bottle to Item Ticket" C_4; and should be "Poison Bottle to item Ticket",C_4; C_OW you miss put 

Btw, i recommend you use switch(select in menu tab, is more easy to use and less tedious. I made an example script to help you:

prontera,150,171,4	script	Item Trader	622,{
	Main:
	disable_items;
  	disable_command;
	mes "[^711872Trader^000000]";
	mes "Hello hello Hello!";
	switch(select("Item Ticket to Yggdrasil Berry:Item Ticket to Poison Bottle:Yggdrasil Berry to Item Ticket:Poison Bottle to Item Ticket:- Close.")) {
	
	case 1:
		next;
		if (checkweight(607,100) == 0 ) goto C_OW;
		if(countitem(7284)<1) goto C_NI;
		delitem 7284,1;
		getitem 607,100;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
	
	case 2:
		next;
		if (checkweight(678,30) == 0 ) goto L_OW;
		if(countitem(7284)<1) goto C_NI;
		delitem 7284,1;
		getitem 678,300;
		next;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
	
	case 3:
		next;
		if(countitem(607)<100) goto C_NI;
		delitem 607,100;
		getitem 7284,1;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
	
	case 4:
		next;
		if(countitem(678)<30) goto C_NI;
		delitem 678,30;
		getitem 7284,1;
		mes "[^711872Trader^000000]";
		mes "[There you go!]";
		close;
		
	case 5:
		next;
		mes "[^711872Trader^000000]";
		mes "See ya!";
		close;
	
	C_OW:
		next;
		mes "[^711872Trader^000000]";
		mes "Sorry you're overweight";
		close;
	
		
	C_NI:
		next;
		mes "[^711872Trader^000000]";
		mes "[You don't have the items]";
		close;

	}
}

I recommend you use disable_items; and disable_command; to prevent exploits. hope it helped you. 😄

OMG Thank you very much! Yes you really helped me understand the mistakes.

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this