Rorso Wizard
Joined: 14 Oct 2000 Posts: 1368
|
Posted: Thu Jul 15, 2004 12:29 pm |
This is how the small text game I have played around with looks:
Code: |
#CLASS {dirs} {setdef}
#ALIAS look {#if (@player.health<=0) {#abort 1};#echo look;showroom @player.room}
#ALIAS south {#if (@player.health<=0) {#abort 1};#if (@attacks/npc != "") {#mxp ~<color gray>Not while fighting!~</color>;#abort 1};id = %concat( "exit", @player.room, "south");targetLocation = %db( @rooms, @id);#if (@targetLocation="") {#mxp You can't walk there. ~<br>;showprompt} {teleport "You walk south" @targetLocation}}
#ALIAS n {north}
#ALIAS s {south}
#ALIAS e {east}
#ALIAS w {west}
#ALIAS north {#if (@player.health<=0) {#abort 1};#if (@attacks/npc != "") {#mxp ~<color gray>Not while fighting!~</color>;#abort 1};id = %concat( "exit", @player.room, "north");targetLocation = %db( @rooms, @id);#if (@targetLocation="") {#mxp You can't walk there. ~<br>;showprompt} {teleport "You walk north" @targetLocation}}
#ALIAS east {#if (@player.health<=0) {#abort 1};#if (@attacks/npc != "") {#mxp ~<color gray>Not while fighting!~</color>;#abort 1};id = %concat( "exit", @player.room, "east");targetLocation = %db( @rooms, @id);#if (@targetLocation="") {#mxp You can't walk there. ~<br>;showprompt} {teleport "You walk east" @targetLocation}}
#ALIAS west {#if (@player.health<=0) {#abort 1};#if (@attacks/npc != "") {#mxp ~<color gray>Not while fighting!~</color>;#abort 1};id = %concat( "exit", @player.room, "west");targetLocation = %db( @rooms, @id);#if (@targetLocation="") {#mxp You can't walk there. ~<br>;showprompt} {teleport "You walk west" @targetLocation}}
#ALIAS teleport {player.room = %2;#mxp %expand( %1);showroom @player.room;; Run trigger if avaible.;%db( @rooms, %concat( "trigger", %2))}
#VAR id {exit15east}
#VAR targetLocation {14}
#VAR exitList {south west}
#CLASS 0
#CLASS {conversations} {setdef}
#ALIAS conversation1 {#if (@convhad1!="true") {showemote "A small man" "grins at you";showsay "A small man" "Ahhhh auuw aww! Who is it I smell?";player.name = %prompt( "Ayran", "What is your name?");showsay "A small man" %concat( "So ", @player.name, " is your name?");showsay "A small man" %concat( @player.name, " ... ", @player.name, ", what a beautiful name.");showemote "A small man" "sighs";showsay "A small man" "I don't have any name. Perhaps once I had? I have been lost here for a long time. Where is that exit? The exit out?";showemote "A small man" "walks away into the darkness. You begin to wonder why you entered this place.";#echo "";convhad1 = true;showprompt}}
#ALIAS conversation2 {#if (%ismember( "troll", @deadNpcs) = 0) {showemote "A troll" "jumps out from nowhere!";showsay "A troll" "Hunger, oh the hunger.";showemote "A troll" "looks at you, hungrily.";causeattack "A troll" "troll" 100}}
#ALIAS showemote {#mxp ~<color gray>%expand( %1) %expand( %2)</color>}
#ALIAS showsay {#mxp ~<color gray>%expand( %1) says, '%expand( %2)'</color>}
#VAR convhad1 {}
#VAR deadNpcs {}
#CLASS 0
#CLASS {genrooms} {setdef}
#ALIAS genrooms {#echo Generating World Data.... Please stand by :);next=%1;processed="";newRooms="";#while @next!="" {currentRoom = %pop( next);#if (%ismember( @currentRoom, @processed) = 0) {processed = %push( @currentRoom, @processed);#echo Generating room @currentRoom;newrooms = %addkey( @newrooms, %concat( "name", @currentRoom), %roomname( @currentRoom));newrooms = %addkey( @newrooms, %concat( "desc", @currentRoom), %trim( %roomdesc( @currentRoom)));#forall @exits {roomExit = %roomlink( @currentRoom, %i);#if (@roomExit > 0) {newrooms = %addkey( @newrooms, %concat( "exit", @currentRoom, %i), @roomExit);#echo Adding exit to the %i;next = %push( @roomExit, @next)}};roomNote = %roomnote( @currentRoom);#if (@roomNote != "") {newrooms = %addkey( @newrooms, %concat( "trigger", @currentRoom), @roomNote)}}};#echo World data generated!}
#VAR exits {north|south|east|west}
#VAR next {}
#VAR currentRoom {13}
#VAR newrooms {name3Before the entrancedesc3You stand before what seems to be the entrance to a large, dark cave. A dense fog fills the forest and the only obvious exit is north - to the inside of the cave.exit3north4name4Inside the cavedesc4As you enter the cave darkness is all around you. It is as if the deeper inside you go the darker it becomes. A faint glow of light can be glimpsed coming in from the south. It might very well be the exit out of the cave. There seems to be a path continuing north from here.exit4north5exit4south3name5A bright little placedesc5This part of the cave is all different from the other parts. A small chair has been put in the center of the room. Small torches flickers gently. It feels like you are hopelessly lost in the cave.exit5west6trigger5conversation1name6The wet corridordesc6As you continue to walk you hear water dripping down from the ceiling. The walls glows brightly here, almost as if they were made of crystals. There are exits to the east, west, and north from here.exit6north8exit6east5exit6west7name7A maze of tunnelsdesc7The tunnels seem to twist around, starting where another one begins.exit7north10exit7south9exit7east6exit7west7name9A maze of tunnelsdesc9The tunnels seem to twist around, starting where another one begins.exit9north7exit9south10exit9east9exit9west7name10A maze of tunnelsdesc10The tunnels seem to twist around, starting where another one begins.exit10north9exit10south7name8The Troll's Hideoutdesc8The ground here is cold. Small symbols have been carved into the walls here. Some look like animals.exit8north11exit8south6trigger8conversation2name11Somewhere in the cavedesc11You look around, trying to determine where you are without much success. Everything looks the same!exit11north12exit11south8name12Before The Exitdesc12Rays of light scares away the darkness. An exit out, maybe, is located to the north. Darkness fills the rest of the cave.exit12north13exit12south11name13The Forest Pathdesc13The forest is filled with fog. You stand on a small path leading south towards a cave, and to the north towards what seems to be a brick house. You can make out a small swamp to the west of the house.exit13north14exit13south12name14The old Brick Housedesc14You stand in front of the front door of an old brick house. There is a sign nailed onto the door: 'Knock to enter'. To the west there seems to be a swamp.exit14south13exit14west15name15The Swamp Of Mysteriesdesc15exit15east14}
#VAR processed {15|14|13|12|11|8|10|9|7|6|5|4|3}
#VAR roomExit {-1}
#VAR roomNote {}
#BUTTON 1 {generate rooms} {genrooms 3;rooms=@newrooms;startgame} {} {} {} {} {} {Size} {87} {23} {} {} {} {} {} {} {} "" {} {} {}
#CLASS 0
#CLASS {attacks} {setdef}
#ALIAS causeattack {; %1 = npc name;; %2 = lookup keyword;; %3 = hp;npc.name=%1;npc.health=%3;npc.lookup=%2;#beep 16;progressattack}
#ALIAS progressattack {#if (@npc.health > 0) {showemote @npc.name "holds a sword close to your body!!!";#mxp ~<color gray>~<br>What do you do?~</color>;#mxp ~<color white>~<send>Parry~</send>, ~<send>Attack~</send>, ~<send>Flee~</send>!, ~<send>Smile~</send>~</color>}}
#ALIAS causedamage {player.health = %eval( @player.health - %1);#if (@player.health <= 0) {npc="";showgameover}}
#ALIAS causedamageNpc {npc.health = %eval( @npc.health - %1);#if (@npc.health <= 0) {showemote @npc.name "screams as it falls onto the ground.";./conversations/deadNpcs = %push( @npc.lookup, @deadNpcs);npc=""}}
#VAR exitList {north }
#VAR npc {}
#ONINPUT {parry} {#if (@player.health<=0) {#abort 1};#if (@npc="") {#mxp ~<color gray>Parry what?~</color>;#echo "";showprompt} {#case %random( 1, 2) {showemote @npc.name "laughs at your failed attempt!";causedamage %random( 1, 20);progressattack;#echo "";showprompt} {showemote @npc.name "screams angrily as you parry its attack!";progressattack;#echo "";showprompt}}}
#ONINPUT {attack} {#if (@player.health<=0) {#abort 1};#if (@npc="") {#mxp ~<color gray>Attack what?~</color>;#echo "";showprompt} {#case %random( 1, 2) {showemote @npc.name "laughs at your failed attempt!";causedamage %random( 1, 20);progressattack;#echo "";showprompt} {showemote @npc.name "screams angrily as you attack it.";causedamageNpc %random( 1, 20);progressattack;#echo "";showprompt}}}
#CLASS 0
#ALIAS startgame {#clr;text = "C r y s t a l D r e a m s";intensity = 200;newtext="";#loop 1,%len( @text) {intensityHex = %mss( %concat( "hex(", @intensity , ")"));intensityHex = %if( %len( @intensityHex)=1, %concat( "0", @intensityHex), @intensityHex);color = %concat( "#00", @intensityHex, @intensityHex);newtext = %concat( %expand( @newtext, 1), "<color ", @color, ">", %copy( @text, %i, 1), "</color>");intensity = %mod( %eval( @intensity - 4), 255)};#mxp 6 ~<color white>============================</color>;#mxp ~<font "Ms Sans" size=15><b>@newtext</b></font>;#mxp ~<color white>============================</color>;#mxp ~<color darkcyan>(c) 2004 Rorso</color><br>;player.room = 3;player.health = 100;conversations/convhad1="";conversations/deadNpcs="";attacks/npc="";showroom @player.room}
#ALIAS showgameover {#mxp ~<color white>==========================~</color>;#mxp ~<color red>G a m e ~ O v e r ~</color>;#mxp ~<color white>==========================~</color>}
#ALIAS showprompt {#mxp ~<color white>@{player.health}hp @{player.mana}mana ></color>}
#ALIAS showroom {room.name = %db( @rooms, %concat( "name", %1));room.desc = %db( @rooms, %concat( "desc", %1));desc = @room.desc;fixedDesc = "";#while (@desc!="" and %len( @desc)>80) {index=80;#while (%copy( @desc, @index, 1) != " ") {index=%eval( @index-1)};index=%eval( @index+1);fixedDesc=%concat( %expand( @fixedDesc, 1), %left( @desc, %eval( @index-1)), "<br>");desc=%copy( @desc, @index, %len( @desc))};fixedDesc = %concat( %expand( @fixedDesc, 1), @desc);#mxp ~<color red>%proper( @room.name)</color>;showexits %1;#mxp ~<color gray>@fixedDesc</color><br>;showprompt}
#ALIAS showexits {exitList="";#if (%db( @rooms, %concat( "exit", %1, "north"))!="") {exitList=%concat( @exitList, "north ")};#if (%db( @rooms, %concat( "exit", %1, "south"))!="") {exitList=%concat( @exitList, "south ")};#if (%db( @rooms, %concat( "exit", %1, "east"))!="") {exitList=%concat( @exitList, "east ")};#if (%db( @rooms, %concat( "exit", %1, "west"))!="") {exitList=%concat( @exitList, "west")};#mxp Exits: @exitList}
#VAR text {C r y s t a l D r e a m s}
#VAR intensity {96}
#VAR color {#006464}
#VAR newtext {<color #00C8C8>C</color><color #00C4C4> </color><color #00C0C0>r</color><color #00BCBC> </color><color #00B8B8>y</color><color #00B4B4> </color><color #00B0B0>s</color><color #00ACAC> </color><color #00A8A8>t</color><color #00A4A4> </color><color #00A0A0>a</color><color #009C9C> </color><color #009898>l</color><color #009494> </color><color #009090> </color><color #008C8C>D</color><color #008888> </color><color #008484>r</color><color #008080> </color><color #007C7C>e</color><color #007878> </color><color #007474>a</color><color #007070> </color><color #006C6C>m</color><color #006868> </color><color #006464>s</color>}
#VAR intensityHex {64}
#VAR player {health100mana100room3nameAyran}
#VAR rooms {name3Before the entrancedesc3You stand before what seems to be the entrance to a large, dark cave. A dense fog fills the forest and the only obvious exit is north - to the inside of the cave.exit3north4name4Inside the cavedesc4As you enter the cave darkness is all around you. It is as if the deeper inside you go the darker it becomes. A faint glow of light can be glimpsed coming in from the south. It might very well be the exit out of the cave. There seems to be a path continuing north from here.exit4north5exit4south3name5A bright little placedesc5This part of the cave is all different from the other parts. A small chair has been put in the center of the room. Small torches flickers gently. It feels like you are hopelessly lost in the cave.exit5west6trigger5conversation1name6The wet corridordesc6As you continue to walk you hear water dripping down from the ceiling. The walls glows brightly here, almost as if they were made of crystals. There are exits to the east, west, and north from here.exit6north8exit6east5exit6west7name7A maze of tunnelsdesc7The tunnels seem to twist around, starting where another one begins.exit7north10exit7south9exit7east6exit7west7name9A maze of tunnelsdesc9The tunnels seem to twist around, starting where another one begins.exit9north7exit9south10exit9east9exit9west7name10A maze of tunnelsdesc10The tunnels seem to twist around, starting where another one begins.exit10north9exit10south7name8The Troll's Hideoutdesc8The ground here is cold. Small symbols have been carved into the walls here. Some look like animals.exit8north11exit8south6trigger8conversation2name11Somewhere in the cavedesc11You look around, trying to determine where you are without much success. Everything looks the same!exit11north12exit11south8name12Before The Exitdesc12Rays of light scares away the darkness. An exit out, maybe, is located to the north. Darkness fills the rest of the cave.exit12north13exit12south11name13The Forest Pathdesc13The forest is filled with fog. You stand on a small path leading south towards a cave, and to the north towards what seems to be a brick house. You can make out a small swamp to the west of the house.exit13north14exit13south12name14The old Brick Housedesc14You stand in front of the front door of an old brick house. There is a sign nailed onto the door: 'Knock to enter'. To the west there seems to be a swamp.exit14south13exit14west15name15The Swamp Of Mysteriesdesc15exit15east14}
#VAR room {nameBefore the entrancedescYou stand before what seems to be the entrance to a large, dark cave. A dense fog fills the forest and the only obvious exit is north - to the inside of the cave.}
#VAR bestBreak {0}
#VAR break {0}
#VAR desc {cave.}
#VAR index {80}
#VAR fixedDesc {You stand before what seems to be the entrance to a large, dark cave. A dense <br>fog fills the forest and the only obvious exit is north - to the inside of the <br>cave.}
#BUTTON 2 {Start Game} {startgame} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {}
|
To try it you have to copy the code to a .zsc file and then import it to a new, empty zMUD file. To start it press the "Start Game" button, or use the startgame alias. Don't press the "generate rooms" button though as that will wipe the room data. |
|