Script Function: Q4YH
From Ultima Online: The Second Age
function void Q4YH(int Q5UT) { list Q5MR; Q4SL(Q5MR, Q5UT); loc Q66U = getLocation(Q62D); if (!Q5YB(Q62D, Q5MR)) { systemMessage(Q62D, "You lack the necessary reagents to inscribe this spell."); return (); } int Q5US = Q4SY(Q5UT); int Q55B = Q4SX(Q5US); if (Q49R(Q62D, Q66U, Q55B)) { loseMana(Q62D, Q55B); int Q4OU = 0x00; int Q4IA = Q4SW(Q4T1(Q5UT)); if (!Q4A8(Q62D, Q4T1(Q5UT))) { Q4OU = 0x01; } if (!Q4OU) { if (testAndLearnSkill(Q62D, 0x17, Q4IA, 0x32) <= 0x00) { Q4OU = 0x01; } } if (Q4OU) { systemMessage(Q62D, "You fail to inscribe the scroll, and the scroll is ruined."); destroyOne(Q56M); return (); } int Q5AL = Q4T3(Q5UT); Q43Q = requestCreateObjectAt(Q5AL, getLocation(Q62D)); destroyOne(Q56M); string Q5WZ; Q5WZ = Q5AL; attachscript(Q43Q, Q5WZ); int Q4Q1; obj Q47G = getBackpack(Q62D); if (canHold(Q47G, Q43Q)) { Q4Q1 = putObjContainer(Q43Q, Q47G); sfx(getLocation(Q62D), 0x0249, 0x00); systemMessage(Q62D, "You inscribe the spell and put the scroll in your backpack."); } else { if (isValid(Q56M)) { Q4Q1 = teleport(Q56M, getLocation(Q62D)); } sfx(getLocation(Q62D), 0x0249, 0x00); systemMessage(Q62D, "You inscribe the spell and put the scroll at your feet."); } if (isValid(Q56M)) { if (hasObjVar(Q56M, "inUse")) { removeObjVar(Q56M, "inUse"); } if (hasScript(Q56M, "removeinuse")) { detachScript(Q56M, "removeinuse"); } } } else { systemMessage(Q62D, "You fail to inscribe the scroll, and the scroll is ruined."); destroyOne(Q56M); return (); } return (); }