Community

SCI Programming => Mega Tokyo SCI Archive => Topic started by: Te Rangi on November 10, 2002, 05:51:00 PM

Title: Help (Part II)
Post by: Te Rangi on November 10, 2002, 05:51:00 PM
Code: [Select]
/******************************************************************************
 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 "autodoor")
(use "jump")
(use "dpath")
(use "wander")
/******************************************************************************/
(instance public rm001 of Rm
   (properties
      picture scriptNumber
      // Set up the rooms to go to/come from here
      north 0
      east 0
      south 0
      west 0
   )
   (method (init)

 (aDoor:init())

 (aDroid:
  init()
  setCycle(Walk)
 setMotion(
     DPath
   230 190
   285 190
   285 130
   230 130
   230 190

  (anotherDroid:
  init()
  setCycle(Walk)
  setMotion(Wander)
  )
 )

// 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(50 140)
                 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)
        (var dyingScript)
        (super:handleEvent(pEvent))
        (if(< (send gEgo:distanceTo(aDroid)) 30)
        Print("These droids aren't as friendly as they look. Noticing you on his optical sensors, he blasts you with his laser. Ouch.")
        Print("You fall to the ground, dead. I hope you enjoy your new butthole!")
        SetUpEgo(0 3)
 = dyingScript ScriptID(DYING_SCRIPT)
 (send dyingScript:
    caller(3)
    register("Your body lays there for a few days, until it is scraped up by a cleaning droid. Yummy.")
  )
  (send gGame:setScript(dyingScript))
)
        (if(< (send gEgo:distanceTo(anotherDroid)) 30)
        Print("These droids aren't as friendly as they look. Noticing you on his optical sensors, he blasts you with his laser. Ouch.")
        Print("You fall to the ground, dead. I hope you enjoy your new butthole!")
        SetUpEgo(0 3)
 = dyingScript ScriptID(DYING_SCRIPT)
 (send dyingScript:
    caller(3)
    register("Your body lays there for a few days, until it is scraped up by a cleaning droid. Yummy.")
  )
  (send gGame:setScript(dyingScript))
)


        /*****************************************
         * Handle the possible said phrases here *
         *****************************************/
        (if(Said('look'))
         (if(< (send gEgo:distanceTo(anotherDroid)) 50)
         Print("Now isn't a good time for looking.")
         )(else
        Print("You are wandering through strange maze of corridors.")

       )
      )
     )
    )
/******************************************************************************/
(instance aDroid of Act
  (properties
    y 190
    x 230
    view 2
  )
)
(instance anotherDroid of Act
  (properties
    y 140
    x 10
    view 2
  )
)
(instance aDoor of AutoDoor
  (properties
    entranceTo 2
    locked FALSE
  )
)



This script gives me an 'Oops!' error when I try to run it.
Title: Re:Help (Part II)
Post by: Brian Provinciano on November 10, 2002, 09:59:01 PM
I didn't look at the script itself. However, just comment out all of your code, then uncomment it one line at a time until you find the source of the error. That's the best way.

Altertatively, you can do a Print("1") Print("2") Print("3") etc. between your lines. Run it, if it goes "1" "2", then you know the error is after 2, before 3!