Advertisement
CaptainLepidus

IF Engine

Oct 1st, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.     //Here I define the main parts of the story
  3.     name = 'Mystery at Arkan';
  4.     author = 'CaptainLepidus';
  5.     intro = 'A whistle is blown. A sudden jolt makes you jump. The doors open, and you step outside. The heated train did not leave you prepared for the cold of the station. Gingerly, you rub your hands together.';
  6.     var i , j , k;
  7.     blank = '%blank%line';
  8.     draw_set_color(c_white);
  9.     draw_set_font(fnt_courier);
  10.     //this is just the offset of the text
  11.     off = 2;
  12.     //alive/dead :P
  13.     alive = 1;
  14.     //
  15.     //  Initialized the collection of lines for display
  16.     //
  17.     {
  18.       global.maxline = room_height / string_height( '|' ) - 4;
  19.       for (i=0; i<global.maxline; i+=1)
  20.       {
  21.         global.line[i] = blank;
  22.         global.color[i] = c_black;
  23.       }
  24.     }
  25.     //inventory
  26.     {
  27.       global.maxinv = 5;
  28.       for (i=0; i<global.maxline; i+=1)
  29.       {
  30.         global.inv[i] = -1;
  31.         global.invs[i] = -1;
  32.       }
  33.     }
  34.     lx = global.maxline;
  35.     quit = 0;
  36.     //player start coords
  37.     px = 10;
  38.     py = 10;
  39.     pz = 10;
  40.     tx = px;
  41.     ty = py;
  42.     tz = pz;
  43.     sz = pz;
  44.     //world size
  45.     h = 20;
  46.     w = 20;
  47.     d = 20;
  48.     //this sets up the rooms
  49.     for(k=0;k<=d;k=k+1)
  50.     for(j=0;j<=h;j=j+1)
  51.     for(i=0;i<=w;i=i+1)
  52.     {
  53.         zz[ i , j ] = j * w + i;
  54.         nn[ zz[ i , j ] , k ] = '';
  55.         rm[ zz[ i , j ] , k ] = '';
  56.         so[ zz[ i , j ] , k ] = 1;
  57.         sx[ zz[ i , j ] , k ] = 0;
  58.         sy[ zz[ i , j ] , k ] = 0;
  59.         sz[ zz[ i , j ] , k ] = 0;
  60.         st[ zz[ i , j ] , k ] = '';
  61.         se[ zz[ i , j ] , k ] = 0;
  62.         de[ zz[ i , j ] , k ] = 0;
  63.         rr[ zz[ i , j ] , k ] = 0;
  64.     }
  65.     //this is setting up all the rooms that I have defined, rooms are like rooms in GM
  66.     sr( 0 , 0 , 0 , 'The station is a rather simple affair; merely a platform next to the tracks, which lie to the south. North is the town square. You can make out a few buildings, but a mist seems to pervade the town.' , 0 , 'Arkan Station' );
  67.     sr( 0 , 1 , 0 , 'The tracks are set off a little below the platform. You are not worried, for trains passing through Arkan are rare. You caught the one you did through luck.' , 0 , 'Tracks' );
  68.     sr( 0 , -1 , 0 , 'This is the upper part of the town square. A little grass patch in the center adds some green to the grey buildings surrounding it. West is the inn; something of an anachronism, perhaps, but then so is the entire town. East is a small, boarded up shop. North leads to the lower town square, and south leads to the train station.' , 0 , 'Arkan Upper Town Square' );
  69.     set_code( 0 , -1 , 0 , 0 , - 1 , 0 , 'This is the upper part of the town square. A little grass patch in the center adds some green to the grey buildings surrounding it. West is the inn; something of an anachronism, perhaps, but then so is the entire town. East is a small, boarded up shop. North leads to the lower town square, and south leads to the train station.' , 3 , 1 );
  70.     sr( 1 , -1 , 0 , 'You open the door to the inn. The warmth is a nice change from the cold of the outside. People crowd around small tables.' , 0 , 'Arkan Inn' );
  71.     set_code( 1 , -1 , 0 , 1 , -1 , 0 , 'Inside the inn, people crowd around small tables.' , 8 , 1 );
  72.     sr( 0 , -2 , 0 , 'You are standing in the lower section of the town square. You can see a church to the east and a bakers to the west. To the south is the bridge into the more "residential" area. To the north is the upper town square.' , 0 , 'Arkan Lower Town Square' );
  73.     sr( -1 , -2 , 0 , 'No one is praying today. Despite the thick stone walls, the church feels no warmer then outside.' , 0 , 'Arkan Church' );
  74.     sr( 0 , -3 , 0 , 'You stand upon the stone bridge that connects the upper and lower parts of Arkan. To the east and west there is water. To the south is the commercial area. To the north lies the houses.' , 0 , 'Arkan Bridge' );
  75.     sr( 0 , -3 , -1 , 'The water is freezing cold. You can reach the bridge above.' , 0 , 'Beneath the Bridge' );
  76.     sr( 0 , -4 , 0 , 'Water laps at the ground beneath you. A bridge stretches south from here towards the shops. A path leads north, and houses stretch out before you.' , 0 , 'River Banks' );
  77.     sr( 0 , -5 , 0 , 'This is the central street; to the east and west, smaller streets are surrounded by shabby houses. The river bank is to the north.' , 0 , 'Central Street' );
  78.     sr( -1 , -5 , 0 , "You stand in a narrow street, with houses towering above you. You're not sure exactly which way is which." , 0 , 'Narrow Street' );
  79.    sr( 1 , -5 , 0 , "You stand in a narrow street, with houses towering above you. You're not sure exactly which way is which." , 0 , 'Narrow Street' );
  80.     pm = 0;
  81.     add_passage( 0 , -3 , -1 , 0 , -3 , 0 );
  82.     im = 0;
  83.     //This sets up some items, items are kinda similar to objects in GM
  84.     trapdoor = create_item_talk( 'hatch' , 'A small trapdoor. It has a lock on it.' , 'Trapdoor' , "Despite the church being empty, you do not want to speak." );
  85.     bartender = create_item( 'barkeep' , 'The bartender is a middle-aged, muscular man with brown hair.' , 'Bartender' , 0 , 0 , '' , "'Hey, I was wondering if you've heard of a man called-' you begin to speak." + chr( 10 ) + "The bartender cuts you off. 'Do you want a drink, or not?'" , 0 , '' , '' , "You don't think that's a good idea." );
  86.    bartender2 = create_item_talk( 'barkeep' , 'The bartender is a middle-aged, muscular man with brown hair.' , 'Bartender' , "'I just wanted to ask-'" + chr( 10 ) + "'Well you can't. Now buy something or leave.' His voice takes on an all to aggressive tone, and you decide to back out." );
  87.     bartender3 = create_item_talk( 'barkeep' , 'The bartender is a middle-aged, muscular man with brown hair.' , 'Bartender' , "You don't think that it's a good idea to ask for any more information from him. And you're not in the mood for a drink." );
  88.    //This code configures how items will change when you talk to them-ie, talking to bartender changes him into a different type of bartender with a different response
  89.    set_talk( bartender , bartender2 );
  90.    set_talk( bartender2 , bartender3 );
  91.    om = 0;
  92.    //Objects are like instances, they can go in rooms and can be a particular object
  93.    add_object( 1 , -1 , bartender , 1 , 'The bartender is bending over the bar.' , 0 );
  94.    add_object( -1 , -2 , trapdoor , 1 , 'A slightly conspicuous trapdoor is fitted to the ground.' , 0 );
  95.    cm = 0;
  96.    jm = 0;
  97.    //this lets you jump off things :D
  98.    set_jump( 0 , -3 , 0 , 0 , -3 , -1 , 'You hit the water with a splash.' );
  99.    em = 0;
  100.    ec = 0;
  101.    //Events are the little messages that will appear from time to time
  102.    add_event( 'So, this is your first sight of Arkan. The train station is run down. No other passengers exited here. As you survey your surroundings, the train behind you takes off.' , 1 );
  103.    add_event( "You review what you know. Jenny Roth asked you down here to investigate the disappearance of her husband. You are out of work, and you took the job, boring as it sounds." + chr( 10 ) + 'You shake your hands to warm them.' , 1 );
  104.    add_event( "You had better get started, then. It might be a good idea to snoop around a bit, get a feel for the town." , 1 );
  105.    //How to do looping: '',1|'message',1|'',2|'',-2|'message',-1
  106.    add_event( '' , 1 );
  107.    add_event( 'You shake your head, trying to clear it. The cold mist is giving you something of a headache.' , 1 );
  108.    add_event( '' , 2 );
  109.    add_event( '' , -2 );
  110.    add_event( 'You rub your hands against the cold.' , -1 );
  111.    add_event( 'Someone in the inn suddenly emits a laugh.' , 1 );
  112.    add_event( '' ,1 );
  113.    add_event( '' , 2 );
  114.    add_event( '' , -2 );
  115.    add_event( 'The inn quiets down for a moment, then goes back to its usual low hum of converation.' , -1 );
  116.    add_lines( intro );
  117.    add_lines( '%' + name + '%' + ' by ' + author );
  118.    add_lines( 'If you are new to the game, you may want to type "help".' );
  119.    add_lines( desc() );
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement