Script Function: Q4M7
From Ultima Online: The Second Age
function int Q4M7(obj this, obj speaker, string arg) { if (!isShopkeeper(this)) { return (0x01); } loc Q4VS = getLocation(this); loc there = getLocation(speaker); if (getDistanceInTiles(Q4VS, there) > 0x03) { return (0x01); } list Q51Z; list Q5N8; list Q619; string Q618; string Q51Y; string Q60W; int Q4LG; int i; int Q518; int Q4QI; Q4QI = 0x00; Q51Z = "buy", "trade", "commerce", "merchant", "shop", "purchase", "business", "open", "shopkeeper", "trader", "tradesman", "shopkeep"; split(Q619, arg); for(i = 0x00; i < numInList(Q619); i++) { for(Q518 = 0x00; Q518 < numInList(Q51Z); Q518++) { Q51Y = Q51Z[Q518]; Q618 = Q619[i]; if (Q618 == Q51Y) { Q4QI == 0x01; } } } if (!Q4QI) { return (0x01); } Q4QI = 0x00; if (hasObjVar(this, "myJobLocation")) { loc myJobLocation = getObjVar(this, "myJobLocation"); if (hasObjVar(this, "myHomeShop")) { string myHomeShop = getObjVar(this, "myHomeShop"); scoreToSpace(myHomeShop); list Q5GR; split(Q5GR, myHomeShop); myHomeShop = Q5GR[0x00]; if (0x00) { bark(this, myHomeShop); } string Q4GC = ""; list Q4FM; if (getSmallestArea(Q4GC, getLocation(this))) { scoreToSpace(Q4GC); split(Q4FM, Q4GC); Q4GC = Q4FM[0x00]; if (0x00) { bark(this, Q4GC); } } if (Q4GC == myHomeShop) { Q4QI = 0x01; } } if (!Q4QI) { bark(this, "I am sorry, I do not have my wares here with me. Mayhap if thou didst catch me in my shop."); Q4J9(this); return (0x00); } } else { bark(this, "Alas, I have no shop! I cannot do business with thee."); Q4J9(this); return (0x00); } int guildMember = 0xFF; int Q5SW = 0xFE; if (hasObjVar(this, "guildMember")) { Q5SW = getObjVar(this, "guildMember"); } if (hasObjVar(speaker, "guildMember")) { guildMember = getObjVar(speaker, "guildMember"); } if (Q5SW == guildMember) { bark(this, "As thou'rt of my same guild, I shall discount my wares to thee."); Q4J9(this); } shopKeeperOpenBusiness(this, speaker); setObjVar(this, "wasAskedBuy", 0x01); Q4J9(this); return (0x01); }