Twentylevel |
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!?!!? |
Eigen |
Could you please post the code. -Eigen |
Brian_Provinciano |
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. |
Twentylevel |
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")) ) ) /******************************************************************************/ |
Eigen |
/****************************************************************************** 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 |
Twentylevel |
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! |
Brian_Provinciano |
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 (... ...) ) |
Twentylevel |
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! :-\ |
Brian_Provinciano | Just start from scratch and make sure you understand where everything should be pasted. The code Eigen posted was incorrect. |
Eigen | Ok, sorry about that. :- |
mr-t | heh, get a better OS man |
Brian_Provinciano |
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) |
mr-t | ...You must admit, I have quite a sexy voice... |
Brian_Provinciano |
Mr T: Post count-- 478 Mr T: Word count--479 lol |
mr-t | ROFL |