Jump to content
  • 0
Sign in to follow this  
MikZ

ITEM OPTION NO REPEAT OPTION

Question

Good day! Requesting assistant or sample script please.
Re item option npc found on this link



How can to check the slot to make sure that the options will not be the same check slot 1 if STR , then Slot 2~5 cannot use STR.
Been checking this part

 

Please help me. thank you!

// Build the menu of current options.
		for (.@i = 1; .@i <= MAX_ITEM_OPTIONS; ++.@i) {
			// call getequipoption(<equip_index>, <type>, <slot>);
			// if the return is <0, it's a script error.
			// if the return is 0, the slot is empty.
			// if the return is >0, the slot is unavailable.
			.@opt = getequipoption(.@equip_index, .@i, IT_OPT_INDEX);
			if (.@opt > 0)
				.@menu$ += (.@i) + ") " + .options$[.@opt - 1] + ":";
			else
				.@menu$ += (.@i) + ") ^999999Empty^000000" + ":";
		}
		// Option Slot is the actual option slot 0-MAX_ITEM_OPTIONS (@see mmo.h)
		.@option_slot = select(.@menu$);
		
		// Check for used slot and request user action if found.
		if (getequipoption(.@equip_index, .@option_slot, IT_OPT_INDEX) > 0) {
			mes(.@name$);
			mes("This slot is already used up!");
			if (select("^990000Override the slot.^000000", "Choose again.") == 2)
				.@used = true;
			next();
		}
	} while (.@used); // loop if the slot is not to be overridden

 

 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

 

I haven't tested my change, if it generates an error and doesn't work correctly, I believe the intention was clear in the script for you to continue with the change, if you still can't get back to me here with the error so I can try to correct it.

 

 

Change this part of the script:

// Present a list of available bonuses.
	mes(.@name$);
	mes("Which of the following item bonuses would you like to add to this item?");
	next();
	// Build the Options!
	.@menu$ = "";
	for (.@i = 0; .@i < getarraysize(.options$); ++.@i)
		.@menu$ += (.@i + 1) + ") " + .options$[.@i] + ":";
		
	do {
		// Select the options!
		.@option_variable = select(.@menu$);
		next();
		mes(.@name$);
		mesf("You chose ^009900%s^000000!", .options$[.@option_variable - 1]);
		mes("Are you sure?");
		next();
	} while (select("Fo Shizzle.", "I'ma re-evaluate, brah.") == 2);

For this:

// Present a list of available bonuses.
	mes(.@name$);
	mes("Which of the following item bonuses would you like to add to this item?");
	next();
	//Check Option Repeat
	for (.@i = 1; .@i <= MAX_ITEM_OPTIONS; ++.@i) {
		.@opt = getequipoption(.@equip_index, .@i, IT_OPT_INDEX);
		if (.@opt > 0)
			.option_repeat$[getarraysize(.option_repeat$)] = .options$[.@opt - 1];
	}	
	// Build the Options!
	.@menu$ = "";
	for (.@i = 0; .@i < getarraysize(.options$); ++.@i) {
		.@jump = 0;
		for (.@i = 0; .@i < getarraysize(.option_repeat$); ++.@i) {
			if (.option_repeat$[.@i] == .options$[.@i]) {
				.@jump++;
				break;
			}
		}
		if (.@jump == 0)
			.@menu$ += (.@i + 1) + ") " + .options$[.@i] + ":";
	}
	do {
		// Select the options!
		.@option_variable = select(.@menu$);
		next();
		mes(.@name$);
		mesf("You chose ^009900%s^000000!", .options$[.@option_variable - 1]);
		mes("Are you sure?");
		next();
	} while (select("Fo Shizzle.", "I'ma re-evaluate, brah.") == 2);

 

 

Edited by Fou-lu

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
On 3/11/2024 at 10:25 AM, Fou-lu said:

 

I haven't tested my change, if it generates an error and doesn't work correctly, I believe the intention was clear in the script for you to continue with the change, if you still can't get back to me here with the error so I can try to correct it.


// Present a list of available bonuses.
	mes(.@name$);
	mes("Which of the following item bonuses would you like to add to this item?");
	next();
	//Check Option Repeat
	for (.@i = 1; .@i <= MAX_ITEM_OPTIONS; ++.@i) {
		.@opt = getequipoption(.@equip_index, .@i, IT_OPT_INDEX);
		if (.@opt > 0)
			.option_repeat$[getarraysize(.option_repeat$)] = .options$[.@opt - 1];
	}	
	// Build the Options!
	.@menu$ = "";
	for (.@i = 0; .@i < getarraysize(.options$); ++.@i) {
		.@jump = 0;
		for (.@i = 0; .@i < getarraysize(.option_repeat$); ++.@i) {
			if (.option_repeat$[.@i] == .options$[.@i]) {
				.@jump++;
				break;
			}
		}
		if (.@jump == 0)
			.@menu$ += (.@i + 1) + ") " + .options$[.@i] + ":";
	}
	do {
		// Select the options!
		.@option_variable = select(.@menu$);
		next();
		mes(.@name$);
		mesf("You chose ^009900%s^000000!", .options$[.@option_variable - 1]);
		mes("Are you sure?");
		next();
	} while (select("Fo Shizzle.", "I'ma re-evaluate, brah.") == 2);

 

 


Hello, I didn't get nay error. but end up with this. No choices.

image.png.bc621bc311daccc38f4bcb4ece6666a2.png

Edited by MikZ

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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