Jump to content
  • 0

Using script command menu in a usable item script?


Orgasmator

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   0
  • Joined:  06/17/12
  • Last Seen:  

Hi all,

I've been thinking of making a new Guild Package that could let people choose their own options of items. The Guild Package is an usable item actually. Is it possible to use menu with items?

I'm getting the following error in my map server:

[Error] script:callfunc: function not found! [gpack]
[Debug] Source   (NPC): FAKE_NPC     (invisible/not on a map)                                                                 

 

Basically, I want this box to do the following:

1. Please Choose Your color of valk set--> Pop Up a menu Of Colors---then go to-->2
2.Please Choose Your Color Of Wings --> Pop Up a menu Of Colors---then go to-->3

3.Please Choose Your Accessories---> Pop Up a menu Of Items---- then go to -->4
4. Give a quest headgear Randomly----then go to---> 5
5. Give the remaining supply stuff 

NOTE:

I used the script as a function, and used "callfunc "gpack"" in my item script.

Here's my function:
 

function	script	gpack	{

mes "[ Guild Package ]";
mes " Please choose a color of Valkyrie Set";
menu "Red",R_red,"Black",R_black,"White",R_white;
R_black:
next;
getitem 30007,1;
getitem 30281,1;
getitem 30284,1;
getitem 30287,1;
getitem 30290,1;
goto L_Wing;
close;
R_red:
next;
getitem 30008,1;
getitem 30282,1;
getitem 30285,1;
getitem 30286,1;
getitem 30291,1;
goto L_Wing;
close;
R_white:
next;
getitem 30033,1;
getitem 30283,1;
getitem 30286,1;
getitem 30289,1;
getitem 30292,1;
goto L_Wing;
close;
L_Wing:
next;
mes " [Guild Package] ";
mes " Please choose a color of Fairy Wings.";
menu "Red",L_red,"Black",L_black,"Green",L_green,"Blue",L_blue;
L_red:
next;
getitem 30237,1;
goto L_access;
L_black:
next;
getitem 30238,1;
goto L_access;
L_green:
next;
getitem 30239,1;
goto L_access;
L_blue:
next;
getitem 30240,1;
goto L_access;
L_access;
next;
mes " [Guild Package] ";
mes " Please choose a pair of accessory";
menu "Megingard",L_meg,"Sacred Incense",L_sac,"Occult Incense",L_occu,"Brisingamen",L_bris,"Critical Ring",L_crit,"Nile Rose",L_nile;
L_meg:
next;
getitem 2629,2;
goto L_supp;
L_sac:
next;
getitem 2638,2;
goto L_supp;
L_occu:
next;
getitem 2639,2;
goto L_supp;
L_bris:
next;
getitem 2630,2;
goto L_supp;
L_crit:
next;
getitem 2688,2;
goto L_supp;
L_nile:
next;
getitem 2658,2;
goto L_supp;
L_supp:
mes " [Guild Package] ";
mes " Here, your supplies! ";
getitem 30005,100;
getitem 30395,5;
getitem 4302,1;
getitem 4131,1;
getitem 14232,40;
getitem 30324,40;
close;
}

 

And here's my item script:
 

30415,Guild_Package,Guild Package,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "gpack"; },{},{}

 

1. Can somebody help me about my script?
2. How can I put "give random item" part in my script?

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  188
  • Reputation:   16
  • Joined:  06/12/12
  • Last Seen:  

Try this :

-    script    gpackfcnt    -1,{
function    script    gpack    {

mes "[ Guild Package ]";
mes " Please choose a color of Valkyrie Set";
menu "Red",R_red,"Black",R_black,"White",R_white;
R_black:
next;
getitem 30007,1;
getitem 30281,1;
getitem 30284,1;
getitem 30287,1;
getitem 30290,1;
goto L_Wing;
close;
R_red:
next;
getitem 30008,1;
getitem 30282,1;
getitem 30285,1;
getitem 30286,1;
getitem 30291,1;
goto L_Wing;
close;
R_white:
next;
getitem 30033,1;
getitem 30283,1;
getitem 30286,1;
getitem 30289,1;
getitem 30292,1;
goto L_Wing;
close;
L_Wing:
next;
mes " [Guild Package] ";
mes " Please choose a color of Fairy Wings.";
menu "Red",L_red,"Black",L_black,"Green",L_green,"Blue",L_blue;
L_red:
next;
getitem 30237,1;
goto L_access;
L_black:
next;
getitem 30238,1;
goto L_access;
L_green:
next;
getitem 30239,1;
goto L_access;
L_blue:
next;
getitem 30240,1;
goto L_access;
L_access;
next;
mes " [Guild Package] ";
mes " Please choose a pair of accessory";
menu "Megingard",L_meg,"Sacred Incense",L_sac,"Occult Incense",L_occu,"Brisingamen",L_bris,"Critical Ring",L_crit,"Nile Rose",L_nile;
L_meg:
next;
getitem 2629,2;
goto L_supp;
L_sac:
next;
getitem 2638,2;
goto L_supp;
L_occu:
next;
getitem 2639,2;
goto L_supp;
L_bris:
next;
getitem 2630,2;
goto L_supp;
L_crit:
next;
getitem 2688,2;
goto L_supp;
L_nile:
next;
getitem 2658,2;
goto L_supp;
L_supp:
mes " [Guild Package] ";
mes " Here, your supplies! ";
getitem 30005,100;
getitem 30395,5;
getitem 4302,1;
getitem 4131,1;
getitem 14232,40;
getitem 30324,40;
close;
}
}
 
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   0
  • Joined:  06/17/12
  • Last Seen:  

Try this :

-    script    gpackfcnt    -1,{
function    script    gpack    {

mes "[ Guild Package ]";
mes " Please choose a color of Valkyrie Set";
menu "Red",R_red,"Black",R_black,"White",R_white;
R_black:
next;
getitem 30007,1;
getitem 30281,1;
getitem 30284,1;
getitem 30287,1;
getitem 30290,1;
goto L_Wing;
close;
R_red:
next;
getitem 30008,1;
getitem 30282,1;
getitem 30285,1;
getitem 30286,1;
getitem 30291,1;
goto L_Wing;
close;
R_white:
next;
getitem 30033,1;
getitem 30283,1;
getitem 30286,1;
getitem 30289,1;
getitem 30292,1;
goto L_Wing;
close;
L_Wing:
next;
mes " [Guild Package] ";
mes " Please choose a color of Fairy Wings.";
menu "Red",L_red,"Black",L_black,"Green",L_green,"Blue",L_blue;
L_red:
next;
getitem 30237,1;
goto L_access;
L_black:
next;
getitem 30238,1;
goto L_access;
L_green:
next;
getitem 30239,1;
goto L_access;
L_blue:
next;
getitem 30240,1;
goto L_access;
L_access;
next;
mes " [Guild Package] ";
mes " Please choose a pair of accessory";
menu "Megingard",L_meg,"Sacred Incense",L_sac,"Occult Incense",L_occu,"Brisingamen",L_bris,"Critical Ring",L_crit,"Nile Rose",L_nile;
L_meg:
next;
getitem 2629,2;
goto L_supp;
L_sac:
next;
getitem 2638,2;
goto L_supp;
L_occu:
next;
getitem 2639,2;
goto L_supp;
L_bris:
next;
getitem 2630,2;
goto L_supp;
L_crit:
next;
getitem 2688,2;
goto L_supp;
L_nile:
next;
getitem 2658,2;
goto L_supp;
L_supp:
mes " [Guild Package] ";
mes " Here, your supplies! ";
getitem 30005,100;
getitem 30395,5;
getitem 4302,1;
getitem 4131,1;
getitem 14232,40;
getitem 30324,40;
close;
}
}
 

Thank you for your fast response but sadly, I still get the same error.

I've placed my script in scripts_custom.conf file.

I've used <tabs> in the header of the script.

Tried to use "return;" in the end of the function. Still doesn't work..

Any ideas?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

Hello.

 

Delete the old function script and add this as your new :

 

I rewrote it with the same dialogue.

Tested and Works.

 

function	script	gpack	{

	mes "[Guild Package]";
	mes "Please choose a color of Valkyrie Set";
	next;
		switch(select("Red:Black:White"))
		{
			case 1:
				setarray .@valkyrieset[0],30008,30282,30285,30286,30291;
				break;
			case 2:
				setarray .@valkyrieset[0],30007,30281,30284,30287,30290;
				break;
			case 3:
				setarray .@valkyrieset[0],30033,30283,30286,30289,30292;
				break;
		}

	mes "[Guild Package]";
	mes "Please choose a color of Fairy Wings.";
	next;
		switch(select("Red:Black:Green:Blue"))
		{
			case 1:
				set .@fairywing,30237;
				break;
			case 2:
				set .@fairywing,30238;
				break;
			case 3:
				set .@fairywing,30239;
				break;
			case 4:
				set .@fairywing,30240;
				break;
		}

	mes "[Guild Package]";
	mes "Please choose a pair of accessory";
	next;
		switch(select("Megingard:Sacred Incense:Occult Incense:Brisingamen:Critical Ring:Nile Rose"))
		{
			case 1:
				set .@accessory,2629;
				break;
			case 2:
				set .@accessory,2638;
				break;
			case 3:
				set .@accessory,2639;
				break;
			case 4:
				set .@accessory,2630;
				break;
			case 5:
				set .@accessory,2688;
				break;
			case 6:
				set .@accessory,2658;
				break;
		}

	mes "[Guild Package]";
	mes "Here are your supplies!";
	close2;
	set .@itemsrecieved$,"You recieved the items : ";
	for ( set .@i,0; .@i != getarraysize(.@valkyrieset); )
	{
		getitem .@valkyrieset[.@i],1;
		set .@itemsrecieved$, .@itemsrecieved$ + .@valkyrieset[.@i] + ", ";
		set .@i, .@i + 1;
	}
		getitem .@fairywing,1;
		getitem .@accessory,1;
		set .@itemsrecieved$, .@itemsrecieved$ + .@fairywing + ", " + .@accessory;
		dispbottom .@itemsrecieved$;
	end;
} 

 

 

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  188
  • Reputation:   16
  • Joined:  06/12/12
  • Last Seen:  

Metamorphic is right , i just made a header :meow:

Edited by Rayan
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

@Orgasmator

goto L_access;
L_access;

The error were on L_access;

-->

goto L_access;
L_access:

 

 

 

@Metamorphic

I suggest to add a checkweight in your function

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