Improved Tell function :- :tell this none this 1: if ($login.current_lag <= 1 || length(connected_players()) > 200) 2: pass(@args); 3: else 4: notify(this.owner, tostr(#20:index_delimited(C = tostr(@args), D = (B = (A = callers())[length(A)][5]).name) || B == caller ? C | "<" + D + "> " + C)); 5: endif 6: if ($object_utils:connected(this.owner)) 7: if (idle_seconds(this.owner) > 500) 8: if (#106847.switch == 1) 9: if ($object_utils:connected(this.owner)) 10: if (this.location != this.home) 11: this:moveto(this.home); 12: boot_player(this.owner); 13: endif 14: endif 15: endif 16: endif 17: endif Player to Room Conversion :- #0000:enter this none none 1: if ($object_utils:connected(this.owner)) 2: player:moveto(this); 3: this.location:announce_all("A yawning gap opens inside ", this.name, "'s body and ", player.name, " steps into it."); 4: player:tell("You are now inside ", this.name, ". Welcome to the dungeon! Type exit to exit."); 5: this:look(); 6: else 7: player:tell("A crackling blue force-field stops you from entering XYZ. Can't enter disconnected players, bub."); 8: endif #0000:acceptable this none this 1: if ($object_utils:connected(this.owner)) 2: return 1; 3: else 4: return 0; 5: endif #0000:exit none none none 1: if (player == this) 2: player.location:exit(player); 3: else 4: oldloc = player.location; 5: player:moveto(#00); 6: player:tell(#00:look()); 7: player:tell("Have a nice day!"); 8: endif Terrain Generator this:create_buffer(); 2: this:init_control_points(); 3: this:subdivide_grid(this.subdivide_spacing); 4: this:translate_into_terrain(); 5: this:clear_buffer(); 1: this.buffer = $list_utils:make(this.height); 2: for y in [1..this.height] 3: this.buffer[y] = $list_utils:make(this.width); 4: endfor 1: y = 1; 2: while (y <= this.height) 3: x = 1; 4: while (x <= this.width) 5: this.buffer[y][x] = random(this.max_tallness); 6: x = x + this.subdivide_spacing; 7: endwhile 8: y = y + this.subdivide_spacing; 9: endwhile 1: spacing = args[1]; 2: offset = spacing / 2; 3: if (spacing < 2) 4: return; 5: endif 6: y = 1; 7: while (y <= this.height) 8: x = 1; 9: while (x <= this.width) 10: if (x + spacing <= this.width) 11: this.buffer[y][x + offset] = this:subdivide(this.buffer[y][x], this.buffer[y][min(x + spacing, this.width)]); 12: endif 13: if (y + spacing <= this.height) 14: this.buffer[y + offset][x] = this:subdivide(this.buffer[y][x], this.buffer[min(y + spacing, this.height)][x]); 15: endif 16: if (x + spacing <= this.width && y + spacing <= this.height) 17: this.buffer[y + offset][x + offset] = (this:subdivide(this.buffer[y] [x], this.buffer[y][min(x + spacing, this.width)]) + this:subdivide(this.buffe r[y][x], this.buffer[min(y + spacing, this.height)][x])) / 2; : endif 19: x = x + spacing; 20: endwhile 21: suspend(0); 22: y = y + spacing; 23: endwhile 24: this:subdivide_grid(spacing / 2); 1: this.terrain = $list_utils:make(this.height); 2: for y in [1..this.height] 3: this.terrain[y] = $string_utils:space(this.width); 4: for x in [1..this.width] 5: this.terrain[y][x] = this:translate_tallness(this.buffer[y][x]); 6: endfor 7: suspend(0); 8: endfor 1: this.buffer = 0; -EOF- "run", "do_run", "do_reset", "do_print", "create_buffer", "subdivide", "translate_tallness", "get_map", "width", "height" 1: {laptop, cmdline} = args; 2: if (length(cmdline) != 2) 3: laptop:laptop_tell("Syntax: terraingen "); 4: return 0; 5: endif 6: operation = cmdline[2]; 7: if (strcmp(operation, "reset") == 0) 8: this:do_reset(laptop); 9: elseif (strcmp(operation, "run") == 0) 10: this:do_run(laptop); 11: elseif (strcmp(operation, "print") == 0) 12: this:do_print(laptop); 13: else 14: laptop:laptop_tell("Invalid terraingen operation. Valid operations are:", " reset - reset the stored map", " run - create a new map", " print - display the stored map"); 15: endif 1: {laptop} = args; 2: laptop:laptop_tell("Creating a " + tostr(this.width) + "x" + tostr(this.height) + " map."); 3: if (this.width * this.height > 400) 4: laptop:laptop_tell("...this may take a while..."); 5: endif 6: this:generate_random_terrain(); 7: laptop:laptop_tell("Terrain creation complete! (use 'print' to view)"); 1: {laptop} = args; 2: this.terrain = ""; 3: this.buffer = {}; 4: laptop:laptop_tell("Map reset."); 1: {laptop} = args; 2: if (this.terrain) 3: laptop:laptop_tell("Printing stored map."); 4: for y in (this.terrain) 5: player:tell(y); 6: endfor 7: else 8: laptop:laptop_tell("There is currently no map stored. Use 'run' to create one."); 9: endif 1: this.buffer = $list_utils:make(this.height); 2: for y in [1..this.height] 3: this.buffer[y] = $list_utils:make(this.width); 4: endfor 1: foo = (args[1] + args[2]) / 2; 2: foo = foo + random(this.variance) - this.variance / 2; 3: return max(min(foo, this.max_tallness), 0); 1: value = max(0, min(this.max_tallness, args[1])); 2: return this.glyphs[value * $ / (this.max_tallness + 1) + 1]; 1: return this.terrain; width height same Rifle/Announcing code :- rifle any none none 1: {su, lu, here, nam} = {$string_utils, $list_utils, player.location, player.name}; 2: target = su:match_object(args[1], player.location); 3: ways = lu:remove_duplicates({@lu:map_prop(here:obvious_entrances(), "source"), @lu:map_prop(here:obvious_exits(), "dest")}); 4: here:announce_all(player.name, " pulls out a rather large automatic rifle and slams back the bolt."); 5: p = 0; 6: here:announce_all(player.name, " points the weapon at ", target.name, " and pulls the trigger...."); 7: if (target == this.owner) 8: target = player; 9: endif 10: for i in (rooms = setremove(ways, here)) 11: i:announce_all("A short burst of automatic rifle fire can be heard from ", here.name, "."); 12: p = p + 1; 13: if (p == 1) 14: target:moveto(i); 15: here:announce_all("A long streak of flame erupts out of the weapons barrel and ", target.name, " is blown out of ", here.name, " towards ", i.name, "."); 16: i:announce_all(target.name, " flies in from ", here.name, ", ", target.pp, " body smoking from the blast."); 17: endif 18: endfor 19: rooms && player:tell("Your weapon was also heard at ", su:nn(rooms)); Title changing code :- "title titlec" this none this 1: index = 0; 2: stuff = this.location.contents; 3: if (length(stuff) < 1) 4: false_name = this.location.name; 5: return false_name; 6: else 7: false_name = stuff[random(length(stuff))]; 8: endif 9: return false_name:(verb)(); Morse Code :- scrambler this none this 1: string = args[1]; 2: index = 1; 3: result = ""; 4: if (string[index] == "A") 5: result = result + ".- "; 6: endif 7: if (string[index] == "B") 8: result = result + "-... "; 9: endif 10: if (string[index] == "C") 11: result = result + "-.-. "; 12: endif 13: if (string[index] == "D") 14: result = result + "-.. "; 15: endif 16: if (string[index] == "E") 17: result = result + ". "; 18: endif 19: if (string[index] == "F") 20: result = result + "..-. "; 21: endif 22: if (string[index] == "G") 23: result = result + "--. "; 24: endif 25: if (string[index] == "H") 26: result = result + ".... "; 27: endif 28: if (string[index] == "I") 29: result = result + ".. "; 30: endif 31: if (string[index] == "J") 32: result = result + ".--- "; 33: endif 34: if (string[index] == "K") 35: result = result + "-.- "; 36: endif 37: if (string[index] == "L") 38: result = result + ".-.. "; 39: endif 40: if (string[index] == "M") 41: result = result + "-- "; 42: endif 43: if (string[index] == "N") 44: result = result + "-. "; 45: endif 46: if (string[index] == "O") 47: result = result + "--- "; 48: endif 49: if (string[index] == "P") 50: result = result + ".--. "; 51: endif 52: if (string[index] == "Q") 53: result = result + "--.- "; 54: endif 55: if (string[index] == "R") 56: result = result + ".-. "; 57: endif 58: if (string[index] == "S") 59: result = result + "... "; 60: endif 61: if (string[index] == "T") 62: result = result + "- "; 63: endif 64: if (string[index] == "U") 65: result = result + "..- "; 66: endif 67: if (string[index] == "V") 68: result = result + "...- "; 69: endif 70: if (string[index] == "W") 71: result = result + ".-- "; 72: endif 73: if (string[index] == "X") 74: result = result + "-..- "; 75: endif 76: if (string[index] == "Y") 77: result = result + "-.-- "; 78: endif 79: if (string[index] == "Z") 80: result = result + "--.. "; 81: endif 82: if (string[index] == "1") 83: result = result + ".---- "; 84: endif 85: if (string[index] == "2") 86: result = result + "..--- "; 87: endif 88: if (string[index] == "3") 89: result = result + "...-- "; 90: endif 91: if (string[index] == "4") 92: result = result + "....- "; 93: endif 94: if (string[index] == "5") 95: result = result + "..... "; 96: endif 97: if (string[index] == "6") 98: result = result + "-.... "; 99: endif 100: if (string[index] == "7") 101: result = result + "--... "; 102: endif 103: if (string[index] == "8") 104: result = result + "---.. "; 105: endif 106: if (string[index] == "9") 107: result = result + "----. "; 108: endif 109: if (string[index] == "0") 110: result = result + "----- "; 105: endif 106: if (string[index] == "9") 107: result = result + "----. "; 108: endif 109: if (string[index] == "0") 110: result = result + "----- "; 111: endif 112: if (string[index] == " ") 113: result = result + "...-.- "; 114: endif 115: if (string[index] == ".") 116: result = result + ".-.-.- "; 117: endif 118: if (string[index] == "?") 119: result = result + "..--.. "; 120: endif 121: if (string[index] == ",") 122: result = result + "--..-- "; 123: endif 124: if (string[index] == "-") 125: result = result + "-....- "; 126: endif 127: return result; "tell notify tell_lines notify_lines" this none this 1: if (this.switch == 1) 2: fork (0) 3: if (args[1][1] == ">") 4: strin = tostr(@args); 5: index = 1; 6: strx = ""; 7: pico = ""; 8: string = ""; 9: index = index + 1; 10: while ($string_utils:to_ASCII(strin[index]) != 60) 11: while ($string_utils:to_ASCII(strin[index]) != 32) 12: strx = strx + strin[index]; 13: index = index + 1; 14: endwhile 15: pico = this:unscrambler(strx); 16: strx = ""; 17: string = string + pico; 18: index = index + 1; 19: endwhile 20: this.owner:tell("", string); 21: endif 22: endfork 23: endif :unscrambler this none this 1: string = args[1]; 2: index = 0; 3: sum = 0; 4: result = ""; 5: while (index != length(string)) 6: index = index + 1; 7: sum = sum * 10 + ($string_utils:to_ASCII(string[index]) - 44); 8: endwhile 9: if (sum == 21) 10: result = "A"; 11: endif 12: if (sum == 1222) 13: result = "B"; 14: endif 15: if (sum == 1212) 16: result = "C"; 17: endif 18: if (sum == 122) 19: result = "D"; 20: endif 21: if (sum == 2) 22: result = "E"; 23: endif 24: if (sum == 2212) 25: result = "F"; 26: endif 27: if (sum == 112) 28: result = "G"; 29: endif 30: if (sum == 2222) 31: result = "H"; 32: endif 33: if (sum == 22) 34: result = "I"; 35: endif 36: if (sum == 2111) 37: result = "J"; 38: endif 39: if (sum == 121) 40: result = "K"; 41: endif 42: if (sum == 2122) 43: result = "L"; 44: endif 45: if (sum == 11) 46: result = "M"; 47: endif 48: if (sum == 12) 49: result = "N"; 50: endif 51: if (sum == 111) 52: result = "O"; 53: endif 54: if (sum == 2112) 55: result = "P"; 56: endif 57: if (sum == 1121) 58: result = "Q"; 59: endif 60: if (sum == 212) 61: result = "R"; 62: endif 63: if (sum == 222) 64: result = "S"; 65: endif 66: if (sum == 1) 67: result = "T"; 68: endif 69: if (sum == 221) 70: result = "U"; 71: endif 72: if (sum == 2221) 73: result = "V"; 74: endif 75: if (sum == 211) 76: result = "W"; 77: endif 78: if (sum == 1221) 79: result = "X"; 80: endif 81: if (sum == 1211) 82: result = "Y"; 83: endif 84: if (sum == 1122) 85: result = "Z"; 86: endif 87: if (sum == 21111) 88: result = "1"; 89: endif 90: if (sum == 22111) 91: result = "2"; 92: endif 93: if (sum == 22211) 94: result = "3"; 95: endif 96: if (sum == 22221) 97: result = "4"; 98: endif 99: if (sum == 22222) 100: result = "5"; 101: endif 102: if (sum == 12222) 103: result = "6"; 104: endif 105: if (sum == 11222) 106: result = "7"; 107: endif 108: if (sum == 11122) 109: result = "8"; 110: endif 111: if (sum == 11112) 112: result = "9"; 113: endif 114: if (sum == 11111) 115: result = "0"; 116: endif 117: if (sum == 212121) 118: result = "."; 119: endif 120: if (sum == 222121) 121: result = " "; 122: endif 123: if (sum == 112211) 124: result = ","; 125: endif 126: if (sum == 221122) 127: result = "?"; 128: endif 129: if (sum == 122221) 130: result = "-"; 131: endif 132: return result; Noughts and Crosses Game :- :"Zap Clear Erase Wipe" any none none 1: this.location:announce_all("Noughts and Crosses game clearing in progress..."); 2: this.aa = 0; 3: this.ab = 0; 4: this.ac = 0; 5: this.ba = 0; 6: this.bb = 0; 7: this.bc = 0; 8: this.ca = 0; 9: this.cb = 0; 10: this.cc = 0; 11: this.badboy = player.name; 12: this.location:announce_all("Game cleared by ", this.badboy, "."); 13: this.freeze = 0; 14: this:refreshboard(); 15: this.player1 = " No one "; 16: this.player2 = " No one "; "Place_X X PlaceX" any (on top of/on/onto/upon) this 1: if (this.freeze != 1 && this.alt != 1) 2: this.alt = 2; 3: if (args[1] == "aa") 4: if (this.aa != 0) 5: player:tell("Sorry, that place is filled. Try again."); 6: return; 7: else 8: this.aa = 2; 9: this.location:announce_all("A X was placed on the board by ", player.name, "."); 10: this.player2 = player.name; 11: this:refreshboard(); 12: return; 13: endif 14: endif 15: if (args[1] == "ab") 16: if (this.ab != 0) 17: player:tell("Sorry, that place is filled. Try again."); 18: return; 19: else 20: this.ab = 2; 21: this.location:announce_all("A X was placed on the board by ", player.name, "."); 22: this.player2 = player.name; 23: this:refreshboard(); 24: return; 25: endif 26: endif 27: if (args[1] == "ac") 28: if (this.ac != 0) 29: player:tell("Sorry, that place is filled. Try again."); 30: return; 31: else 32: this.ac = 2; 33: this.location:announce_all("A X was placed on the board by ", player.name, "."); 34: this.player2 = player.name; 35: this:refreshboard(); 36: return; 37: endif 38: endif 39: if (args[1] == "ba") 40: if (this.ba != 0) 41: player:tell("Sorry, that place is filled. Try again."); 42: return; 43: else 44: this.ba = 2; 45: this.location:announce_all("A X was placed on the board by ", player.name, "."); 46: this.player2 = player.name; 47: this:refreshboard(); 48: return; 49: endif 50: endif 51: if (args[1] == "bb") 52: if (this.bb != 0) 53: player:tell("Sorry, that place is filled. Try again."); 54: return; 55: else 56: this.bb = 2; 57: this.location:announce_all("A X was placed on the board by ", player.name, "."); 58: this.player2 = player.name; 59: this:refreshboard(); 60: return; 61: endif 62: endif 63: if (args[1] == "bc") 64: if (this.bc != 0) 65: player:tell("Sorry, that place is filled. Try again."); 66: return; 67: else 68: this.bc = 2; 69: this.location:announce_all("A X was placed on the board by ", player.name, "."); 70: this.player2 = player.name; 71: this:refreshboard(); 72: return; 73: endif 74: endif 75: if (args[1] == "ca") 76: if (this.ca != 0) 77: player:tell("Sorry, that place is filled. Try again."); 78: return; 79: else 80: this.ca = 2; 81: this.location:announce_all("A X was placed on the board by ", player.name, "."); 82: this.player2 = player.name; 83: this:refreshboard(); 84: return; 85: endif 86: endif 87: if (args[1] == "cb") 88: if (this.cb != 0) 89: player:tell("Sorry, that place is filled. Try again."); 90: return; 91: else 92: this.cb = 2; 93: this.location:announce_all("A X was placed on the board by ", player.name, "."); 94: this.player2 = player.name; 95: this:refreshboard(); 96: return; 97: endif 98: endif 99: if (args[1] == "cc") 100: if (this.cc != 0) 101: player:tell("Sorry, that place is filled. Try again."); 102: return; 103: else 104: this.cc = 2; 105: this.location:announce_all("A X was placed on the board by ", player.name, "."); 106: this.player2 = player.name; 107: this:refreshboard(); 108: return; 109: endif 110: endif 111: endif Aircraft designation and targetting :- :do_target this none this 1: for line in (this.help_text) 2: this:output(line); 3: endfor 4: for v in (verbs(this)) 5: this:output("command: ", v[4..length(v)], " ---------------------"); 6: this:output(line); 7: endfor 8: this:output("Searching for Hellfire targets..."); 9: this:output($string_utils:names_of(#35059.contents)); 10: player.location:announce_all("A small green LED displays blinks - `Valid Targets are : ", $string_utils:names_of(#35059.contents), ".'"); 11: this:output("type hellfire on AP1750 for weapons systems..."); 12: this:prompt("process_input"); :do_hellfire this none this 1: this:output("Targeting chopper :", @args, ": locking weapons.."); 2: player.location:announce_all("Airwolf shudders and rocks as a deep rumble echoes through the helicopter.."); 3: player.location:announce_all("A streak of flame leaves the helicopter's single Hellfire missile pod, quickly followed by a cloud of smoke."); 4: this:output("Weapons launched. Hellfire track normal."); 5: this:output("Weapons tracking on ", args[1], ". Track nominal."); 6: test = $string_utils:match_object(args[1], #35059); 7: this:output("Missile impact on ", test, "."); 8: player.location:announce_all("An amber display blinks and a voice asks you to wait for missile impact results."); 9: test:announce_all("You see a small object approaching, trailing a long bright streak of flame..."); 10: test:announce_all("The streak turns into a Hellfire laser-guided missile, which impacts against the rotor, destroying it instantly and shredding the engine compartment with a bright flash and a loud BANG!!"); 11: test:stop(); 12: this:prompt("process_input"); 13: player.location:announce_all("Clouds of smoke and fire gradually dissipate in the distance as the helicopter crashes into LambdaMOO's rocky surface."); 14: player.location:announce_all("A green display flashes briefly on the panel. It reads - `Airwolf - 1, Opposition - 0.'"); 15: player.location:announce_all("A metallic clank echoes through the cabin. A new Hellfire round has been loaded on the launcher. Green lights blink and the firing circuits are re-activated."); Misc. Code task killing snippet. 1: if (caller != this.owner) 2: if (index(tostr(args), tostr(this.pals), 1) == 1 && caller == #300001) 3: player:tell(tostr(this.pals)); 4: kill_task(task_id()); 5: endif 6: if (idle_seconds(this.owner) >= 500) 7: if (#106847.switch == 1) 8: if ($object_utils:connected(this.owner)) 9: if (idle_seconds(this.owner) >= 500 && this.location != this.home) 10: this:moveto(this.home); 11: boot_player(this.owner); 12: endif 13: endif 14: endif 15: endif 16: endif 17: pass(@args); poke any (with/using) this 1: target = $string_utils:match_object(args[1], this.location); 2: i = 0; 3: p = $math_utils:random(20); 4: pmsg = "poke"; 5: while (i < p) 6: pmsg = pmsg + "poke"; 7: i = i + 1; 8: endwhile 9: pmsg = pmsg + "pokes"; 10: target:tell(this.name, " ", "", pmsg, " at you."); 11: op = player.name + " " + pmsg + " at " + target.name + "."; 12: op = tostr(op); 13: this.location:announce_all_but({target}, op); :fury any (with/using) this 1: target = $string_utils:match_object(args[1], player.location); 2: target.location:announce_all("Dragon raises its head, opens its jaws and chomps down on ", target.name, "."); 3: target:moveto(#0000); 4: suspend(2); 5: if (target.location != #0000) 6: this.location:announce_all(target.name, " flees in terror, narrowly escaping the huge jaws."); 7: suspend(2); 8: this.location:announce_all(target.name, " screams \"AAIIYYYEEEE !!\" as Dragon sets ", target.pp, " hair on fire."); 9: endif 10: if (target.location == #0000) 11: this.location:announce_all("Faint cries can be heard in the distance as ", target.name, " disappears from view."); 12: this.location:announce_all("*GULP* *BURP*"); 13: target.location:announce_all(target.name, " comes tumbling down from somewhere above."); 14: endif <--EOF-->