Author Topic: Parentheses  (Read 4465 times)

0 Members and 1 Guest are viewing this topic.

Offline Twentylevel

Parentheses
« on: March 01, 2003, 12:02:49 AM »
OK.  I'm starting to go crazy here.  I have cut and pasted DIRECTLY from the tutorial into my roomscript.  EVERY time it gives me a "bracket expected" on some random place.  I have spent all day with this and I'm starting to go crazy.  
I have done everything exactly by the tutorial, and everytime I get this message.  I've had limited success with random deleting/adding brackets.  I even went through bracket by bracket and labeled them in an attempt to find the problem.  Every one matches another.  I will post my code if need be.  But this is a problem on every page of the tutorial.

How do I debug these brackets!?!!?



Offline Eigen

Re:Parentheses
« Reply #1 on: March 01, 2003, 12:40:16 AM »
Could you please post the code.



-Eigen
Artificial Intelligence Competition

Offline Brian Provinciano

Re:Parentheses
« Reply #2 on: March 01, 2003, 01:41:07 AM »
It states a bracked expected at the end of a function. For example:

00: (method (abc)
01:   (....(...)
...
19:    ...
20: )

so if there's a bracket missing on line 1, it will be around line 20 that gets the message.

The compiler has no errors. It's been solid for over a year now, so good that it's barely been changed for over six months. You are probably pasting the code in the wrong spot or something.

Offline Twentylevel

Re:Parentheses
« Reply #3 on: March 01, 2003, 11:11:52 AM »
Really, I understand that every function needs a bracket.  I'm just not able to find the problem.  Maybe I'm not up to speed on these functions yet.  Why does super:init() have a '()' after it?  Sometimes I'm not sure what function goes with what.  Like I said, I'm reduced to randomly placing brackets and deleting them.  I'm not saying your compiler has problems, I'm just saying that I do.
Here's my code, there's probably alot of garbage in there because of my attempts to root out the cause:


/******************************************************************************
 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")
(use "dpath")
/******************************************************************************/

(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)

  // 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(194 101)
    loop(2)
   )
)
      
      // 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 (doit)

  (super (doit())


Display (
"Hello World"
dsCOORD 0 0

dsCOLOR RANDOM(0 15)

dsBACKGROUND clBLACK)
         )
    )
        /*****************************************
         * Handle the possible said phrases here *
         *****************************************/

 (method (handleEvent pEvent)

  (super:handleEvent(pEvent)

  (if(Said('look')

  Print("You are in an empty room"))
 )

  )



/******************************************************************************/


Offline Eigen

Re:Parentheses
« Reply #4 on: March 01, 2003, 12:02:07 PM »
/******************************************************************************
 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")
(use "dpath")
/******************************************************************************/
(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)
      // 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(194 101)
    loop(2)
  )
)
         )

      // 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(doit)
Display("Hello World" dsCOLOR Random(0 15) dsCOORD 0 0 dsBACKGROUND clBLACK)
)
/*****************************************
        * Handle the possible said phrases here *
*****************************************/
(method (handleEvent pEvent)
        (super:handleEvent(pEvent))
(if(Said('look')
Print("You are in an empty room"))
)
)
)


-Eigen
Artificial Intelligence Competition

Offline Twentylevel

Re:Parentheses
« Reply #5 on: March 01, 2003, 01:45:30 PM »
Hmmm.... It compiled and ran, but that set of code made it pop up "You're in an empty room" over and over...  
Also, what exactly did I do wrong??

Oh, and another thing:  I've been building a room and after awhile it gives me an error message.  When I look through my draw list, I see that it has "end of pic" a few draws back followed some random draws (usually a tiny line or line) and then it has the real "end of pic"  I tried rebooting, but I it did it again.  Is this a common problem?  I'm running Win98 - I see from past msgs that Win98 can cause probs.

Thanks!  

Offline Brian Provinciano

Re:Parentheses
« Reply #6 on: March 01, 2003, 05:13:50 PM »
What you are doing with your incorrectly placed brackets is this:

IF( SAID"LOOK"(ignored)  PRINT"You are in an empty room" ) THEN
 ... DO NOTHING
END IF

What you should be doing is:

IF( SAID"LOOK" )  THEN
  Print("You are in an empty room")
END IF

All functions return values, even if they don't set a return value. So you are tesing whether or not Print is TRUE rather than Said is TRUE.

The if syntax is:

( if (...)
  ...
)

you did
(if (...
 ...)
)

Offline Twentylevel

Re:Parentheses
« Reply #7 on: March 01, 2003, 09:58:39 PM »
Ok, I'm completely on top of boolean expressions.  I understand this.  My problem is that the brackets seem to be random.  
I copied Eigens code exactly, and until I added a couple random brackets at the end of the code it didn't work properly.  
Maybe I'm not getting it, but everytime I do something from the tutorial, I get a "bracket" error.  I have been cut/pasting directly from online and every time I have an error.  
The code itself is simple, it's the damn brackets that keep screwing me up.  I'm really pounding my head here!   :-\

Offline Brian Provinciano

Re:Parentheses
« Reply #8 on: March 01, 2003, 10:52:27 PM »
Just start from scratch and make sure you understand where everything should be pasted. The code Eigen posted was incorrect.

Offline Eigen

Re:Parentheses
« Reply #9 on: March 02, 2003, 12:33:58 AM »
Ok, sorry about that. :-[




-Eigen
Artificial Intelligence Competition

Offline Te Rangi

Re:Parentheses
« Reply #10 on: March 03, 2003, 09:26:36 PM »
heh, get a better OS man

Offline Brian Provinciano

Re:Parentheses
« Reply #11 on: March 03, 2003, 10:20:20 PM »
SCI Studio 3 runs the same on Win98 as WinXP now. I made sure all memory is handled and replaced most VCL stuff with my own classes and structs.

(me is really starting to think Mr. T writes just to read himself talk, lol)

Offline Te Rangi

Re:Parentheses
« Reply #12 on: March 03, 2003, 10:45:43 PM »
...You must admit, I have quite a sexy voice...

Offline Brian Provinciano

Re:Parentheses
« Reply #13 on: March 03, 2003, 11:40:45 PM »
Mr T: Post count-- 478
Mr T: Word count--479

lol

Offline Te Rangi

Re:Parentheses
« Reply #14 on: March 04, 2003, 09:59:30 PM »
ROFL


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

Page created in 0.034 seconds with 17 queries.