/usr/share/doc/sludge/ExampleProjects/VerbCoin/iface/inventory.slu is in sludge-doc 2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | var inventory = newStack (drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, drinksCan, mushroom);
var icon;
var currentInvItem = NULL;
objectType inventoryIcon ("inventory") {
event oneCursor = arrowTarget;
event onlyAction {
var rowsNeeded = (stackSize (inventory) - 1) / 9;
var x = 1000, y = 190 - rowsNeeded * 25;
freeze ();
darkBackground ();
mixOverlay ('iface/invback.tga', CENTRE, CENTRE);
var invItems = copyStack (inventory);
# Big black crosshair showing the centre of the screen
# blankArea (0, 239, 639, 240);
# blankArea (319, 0, 320, 479);
while (invItems) {
if (x > 550) {
if (stackSize (invItems) < 9) {
x = 345 - stackSize (invItems) * 25;
} else {
x = 120;
}
y += 50;
}
var thisItem = popFromStack (invItems);
callEvent (getIcon, thisItem);
pasteImage (icon, x, y);
addScreenRegion (thisItem, x - 18, y - 18, x + 18, y + 18, 0, 0, 0);
x += 50;
}
addStatus ();
invGo ();
while (howFrozen ()) pause (1);
}
}
objectType getIcon ("") {
}
objectType inventoryClick ("") {
}
objectType mushroom ("mushroom") {
event getIcon {
icon = anim ('iface/mushroom.duc', 0);
}
event ego {
say (ego, "I'm not about to eat anything from the same food-group as athlete's foot.");
}
event duck {
say (ego, "Hey, duck! Want a mushroom?");
say (duck, "Er, no...");
say (ego, "Ah well. I'll wander around with it for a little longer, then.");
}
}
objectType drinksCan ("fizzy drink") {
event getIcon {
icon = anim ('iface/mouse.duc', 4);
}
event default {
say (ego, "No way! My precious drink deserves better than that...");
}
event ego {
deleteFromStack (inventory, drinksCan);
turnCharacter (ego, SOUTH);
say (ego, "Mmmmm! Thirst-quenching!");
pause (20);
say (ego, "* hic *");
say (ego, "Pardon.");
}
}
sub invGo () {
busy = FALSE;
onLeftMouse (invClick);
onRightMouse (invRight);
onFocusChange (handleFocus);
handleFocus (getOverObject ());
}
sub invRight () {
currentInvItem = NULL;
invGo ();
}
sub invClick () {
var o = getOverObject ();
if (! o) {
unfreeze ();
handleFocus (NULL);
} else if (currentInvItem && currentInvItem != o) {
stop ();
findEvent (currentInvItem, o);
currentInvItem = NULL;
invGo ();
} else {
stop ();
# By default, clicking an inventory object selects it...
# that's unless it's got an "inventoryClick" event
if (! callEvent (inventoryClick, o)) currentInvItem = o;
invGo ();
}
}
|