This Menu for inscript from Spell Book to scrolls
When I click inscript target at Spell Book, there create menu with:
var tmenu := CreateMenu( "Select a circle to inscribe");
After, I click at the any Circle, and there is error in:
var hischoice := SelectMenuItem2(who, tmenu2 ); // .index; // );
4 error{ errortext = "Object does not support members" }
Code: Select all
function MakeAndProcessMenu( who , spellbook )
var circles := { };
foreach spell in EnumerateItemsInContainer(spellbook)
var elem := FindConfigElem(config_file, spell.objtype);
var thecircle := GetConfigInt(elem, "Circle");
circles[thecircle] := 1;
print(" circles[thecircle] := 1; ");
endforeach
var i;
var tmenu := CreateMenu( "Select a circle to inscribe");
if( tmenu.errortext )
print("1 "+ tmenu.errortext );
return 0;
endif
for (i := 1; i <= 8; i := i + 1)
// if (circles[i] == 1)
// if( circles[i] )
var addm := AddMenuItem( tmenu, 0x20bf + i, "Circle " + cstr(i) + " spells");
if(!addm)
print(addm.errortext);
endif
// endif
// SleepMS(5);
endfor
var firstchoice := SelectMenuItem2( who, tmenu ).index; // );
// if (!firstchoice.index)
if( !firstchoice )
print("2 "+ firstchoice.errortext );
return 0;
endif
var tmenu2 := CreateMenu("Select a spell to inscribe");
if( !tmenu2 )
print("3 "+ tmenu2.errortext );
return 0;
endif
var scrolls_objtype := {};
foreach spell in EnumerateItemsInContainer(spellbook)
print(" FIND SPELLBOOK ");
var elem := FindConfigElem(config_file, spell.objtype);
var thecircle := GetConfigInt(elem, "circle");
if (thecircle == firstchoice.objtype - 0x20bf)
var spellname := GetConfigString(elem, "name");
var thetype := GetConfigInt(elem, "graphic");
scrolls_objtype.append( spell.objtype );
AddMenuItem(tmenu2, thetype, spellname);
Print(" AddMenuItem ");
endif
endforeach
var hischoice := SelectMenuItem2(who, tmenu2 ); // .index; // );
if( !hischoice.Index )
// if( !hischoice )
print("4 "+ tmenu2.errortext );
return 0;
else
return scrolls_objtype[hischoice.index];
endif
endfunction
With best regards!