ITEM OPTION NO REPEAT OPTION

MikZ

New member
Messages
461
Points
0
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!

Code:
// 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
 
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:

Code:
// 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);
 
Last edited by a moderator:
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

 
Last edited by a moderator:
Back
Top