Author Topic: Problem in tutorial chapter 15  (Read 3285 times)

0 Members and 1 Guest are viewing this topic.

Offline robingravel

Problem in tutorial chapter 15
« on: June 29, 2002, 09:10:04 AM »
The ego can't change the room from east.

Here my codes:

room 1:

/******************************************************************************
SCI Template Game
By Brian Provinciano
******************************************************************************
rm001.sc
Contains the first room of your game.
******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 1)
/******************************************************************************/
(use "main")
(use "controls")
(use "cycle")
(use "game")
(use "feature")
(use "obj")
(use "inv")
(use "door")
(use "jump")
/******************************************************************************/
(instance public rm001 of Rm
   (properties
      picture scriptNumber
      // Set up the rooms to go to/come from here
      north 0
      east 2
      south 0
      west 0
   )
   (method (init)
      // same in every script, starts things up
       (super:init())
       (self:setScript(RoomScript))
       
       // Check which room ego came from and position it
       (switch(gPreviousRoomNumber)
           /******************************************************
            * Put the cases here for the rooms ego can come from *
            ******************************************************/ /*
           (case north
             (send gEgo:
                posn(210 110)
                loop(2)
             )
          )*/
           // Set up ego's position if it hasn't come from any room
          (default
             (send gEgo:
                posn(150 130)
                loop(1)
             )
          )
       )
      
      // Set up the ego
      SetUpEgo()      
      (send gEgo:init())

       /****************************************
        * Set up the room's music to play here *
        ****************************************/ /*
      (send gTheMusic:
         prevSignal(0)
         stop()
         number(scriptNumber)
         loop(-1)
         play()
      )*/

       /**************************************************
        * Add the rest of your initialization stuff here *
        **************************************************/
 )
)
/******************************************************************************/
(instance RoomScript of Script
   (properties)
   (method (handleEvent pEvent)
       (super:handleEvent(pEvent))

       /*****************************************
        * Handle the possible said phrases here *
        *****************************************/
       (if(Said('look'))
           Print("You are in room 1")
       )
   )
)
/******************************************************************************/



Offline robingravel

Re:Problem in tutorial chapter 15
« Reply #1 on: June 29, 2002, 09:11:32 AM »
Room 2:

(use "main")
(use "controls")
(use "cycle")
(use "game")
(use "feature")
(use "obj")
(use "inv")
(use "door")
(use "jump")
/******************************************************************************/
(instance public rm002 of Rm
   (properties
      picture scriptNumber
      // Set up the rooms to go to/come from here
      north 0
      east 0
      south 0
      west 1
   )
   (method (init)
      // same in every script, starts things up
       (super:init())
       (self:setScript(RoomScript))

       // Check which room ego came from and position it
       (switch(gPreviousRoomNumber)
           /******************************************************
            * Put the cases here for the rooms ego can come from *
            ******************************************************/ /*
           (case east
             (send gEgo:
                posn(210 110)
                loop(2)
             )
          )*/
           // Set up ego's position if it hasn't come from any room
          (default
             (send gEgo:
                posn(150 130)
                loop(1)
             )
          )
       )

      // Set up the ego
      SetUpEgo()
      (send gEgo:init())

       /****************************************
        * Set up the room's music to play here *
        ****************************************/ /*
      (send gTheMusic:
         prevSignal(0)
         stop()
         number(scriptNumber)
         loop(-1)
         play()
      )*/

       /**************************************************
        * Add the rest of your initialization stuff here *
        **************************************************/
 )
)
/******************************************************************************/
(instance RoomScript of Script
   (properties)
   (method (handleEvent pEvent)
       (super:handleEvent(pEvent))

       /*****************************************
        * Handle the possible said phrases here *
        *****************************************/
       (if(Said('look'))
           Print("You are in room 2")
       )
   )
)
/******************************************************************************/

Did I miss something?

Robin Gravel

Offline robingravel

Re:Problem in tutorial chapter 15
« Reply #2 on: June 29, 2002, 02:13:36 PM »
Finally I solved my problems by deleting script files on the game directory.

Making src directory, copy any sc and sh files in src directory. Deleting sc and sh files in the game directory.

Recompiling scripts using sc and sh files from src directory. My head hurt.

Yes. Another DG game is coming soon in sci.

Robin Gravel

Offline Brian Provinciano

Re:Problem in tutorial chapter 15
« Reply #3 on: June 29, 2002, 03:21:21 PM »
For one thing, if you add a class, you must add it to the end of the script, you can't insert it at the beginning. It will mess up the class system.

If you have any of these problems, just click on the menu Compile > Compile All Scripts.

If you have a room 2, you must make sure the top line reads:

(script 2)

For room 3, the top line must read (script 3), etc.

Instead of creating a blank script and copying script.001, use the menu File > New > Room Script.

Good luck!

Joe

  • Guest
Re:Problem in tutorial chapter 15
« Reply #4 on: June 29, 2002, 03:27:45 PM »
Can't you place the instances between the two script and room instances?

Offline Brian Provinciano

Re:Problem in tutorial chapter 15
« Reply #5 on: June 29, 2002, 05:12:54 PM »
Yes. You can rearrange instances within your scripts without problems (unless you have more than one public instance, which I doubt anyone will).


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.063 seconds with 15 queries.