Author Topic: Beginner's question: why won't this compile?  (Read 2287 times)

0 Members and 1 Guest are viewing this topic.

Offline sithlord2

Beginner's question: why won't this compile?
« on: January 16, 2019, 11:42:54 AM »
So I installed SCICompanion, created a new game(Sci Studio syntax), and I created a view that I want to add to the default room. The view is called "n001". If I understand the tutorials correctly, I should add the an instance of the view at the end, and call the init routine.

This what I have:

---
/******************************************************************************
 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(150 130)
                 loop(1)
              )
           )
        )
      
      // Set up the ego
      SetUpEgo()      
      (send gEgo:init())
      (send n001: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 an empty room")
        )
    )
)
/******************************************************************************/


(instance n001 of Prop
   (properties
      view 001
      x 150
      y 100
      loop 0
      cel 0
      priority 0
   )
)
---

But this refuses to compile. I get the error "Unknown identifier: can not send to n001".

What am I missing?



Offline Collector

Re: Beginner's question: why won't this compile?
« Reply #1 on: January 16, 2019, 12:06:35 PM »
I am sure others will help shortly, but it is strongly recommended that you use Sierra Script. The SCI Studio syntax is really there just for backwards compatibility with older games developed with SCI Studio or earlier versions of Companion. You can convert to Sierra from the menubar > Game > Properties and select "Sierra Script" from the Script Language dropdown.
KQII Remake Pic

Offline Doan Sephim

Re: Beginner's question: why won't this compile?
« Reply #2 on: January 16, 2019, 12:13:24 PM »
I only came upon 1 issue with this code when I copy/pasted it into an empty room:

(send n001:init()) should simply be (n001:init())

You won't need the "send" for Props and Acts that you create.

Try that and see if that works for you.

Offline Kawa

Re: Beginner's question: why won't this compile?
« Reply #3 on: January 16, 2019, 01:24:11 PM »
You won't need the "send" for Props and Acts that you create.
Rather, you need it for objects in variables, like gEgo. n001 isn't.

Or you could just use Sierra Script and not worry about send at all.

Offline sithlord2

Re: Beginner's question: why won't this compile?
« Reply #4 on: January 16, 2019, 02:46:18 PM »
Thanks. I switched to Sierra Script syntax, and everything seems to work as expected :-)

Offline sithlord2

Re: Beginner's question: why won't this compile?
« Reply #5 on: January 16, 2019, 03:10:40 PM »
So, next challenge was to see if I could change the colors of the menubar. I guess the file MenuBar.sc would be a good place to look. Call me naive, but I expected it to be easy, like, just change two variables or something like that...

It seems... I was wrong:

---
         (MENU_COLOURS
            (= wndCol 16)
            (while (and (u> wndCol 15) (!= wndCol -1))
               (= wndCol (GetNumber {New Text Color: (0-15)}))
            )
            (if (!= wndCol -1)
               (= wndBack 16)
               (while
                  (or
                     (and (!= wndBack -1) (u> wndBack 15))
                     (== wndCol wndBack)
                  )
                  (= wndBack (GetNumber {New Background Color: (0-15)}))
               )
               (if (!= wndBack -1)
                  (= gWndColor wndCol)
                  (= gWndBack wndBack)
                  (gTheWindow color: gWndColor back: gWndBack)
               )
            )
         )
---

Okay, I have no clue what I should change...

Is there a demo or template game that comes with documented code?

Offline MusicallyInspired

Re: Beginner's question: why won't this compile?
« Reply #6 on: January 16, 2019, 03:29:28 PM »
I accomplished this before but it's been so long now...
Brass Lantern Prop Competition

Offline Kawa

Re: Beginner's question: why won't this compile?
« Reply #7 on: January 16, 2019, 03:43:57 PM »
I thought the menu bar was a fixed color? LSL3 has this thing where you can set the window color, and that's what's in your script here. SCI11 allowed DrawStatus to include color indices, but even that doesn't affect LSL6's menu bar -- it's as black on white as any.

Offline troflip

Re: Beginner's question: why won't this compile?
« Reply #8 on: January 16, 2019, 04:14:57 PM »
Yeah, I think the menu bar is always black and white.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Beginner's question: why won't this compile?
« Reply #9 on: January 16, 2019, 05:30:15 PM »
Aaand I just got a stupid idea for SCI11+.
« Last Edit: January 16, 2019, 06:01:38 PM by Kawa »

Offline MusicallyInspired

Re: Beginner's question: why won't this compile?
« Reply #10 on: January 16, 2019, 05:41:16 PM »
Really? It's just a display command in Main.sc isn't it?
Brass Lantern Prop Competition

Offline Kawa

Re: Beginner's question: why won't this compile?
« Reply #11 on: January 16, 2019, 05:53:25 PM »
Really? It's just a display command in Main.sc isn't it?
Only QFG4 and SQ5 used Display commands to draw their status lines. Every other SCI0-11 game either had no line at all or used DrawStatus. I've studied this quite extensively.


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.095 seconds with 24 queries.