Community
SCI Programming => Mega Tokyo SCI Archive => Topic started by: robingravel on October 02, 2002, 10:07:57 PM
-
Hi
I tried printing with box but it doesn't work. I got
indefined symbol "var"
Here the codes:
/******************************************************************************
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
-
you need to declare your vars at the top of your method or procedure.
eg:
Good:
(method (foo)
(var a)
Print("Hello")
Print("There")
)
Bad:
(method (foo)
Print("Hello")
(var a)
Print("There")
)
-
Thanks Brian.
Now I got "out bracket" message.
Here my codes:
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
(super:handleEvent(pEvent))
/*****************************************
* Handle the possible said phrases here *
*****************************************/
(if(Said('look'))
(method (foo)
(var button)
//= button
Print("You are in an empty room")
Print(
"Do you want to click Yes or No?"
#title "Click What?"
#font LARGE_FONT
#icon 0 0 0
#button " Yes " 1
#button " No " 0
)
(if(== button 1)
Print("You clicked YES")
)(else
Print("You clicked NO")
)
)
)
)
)
)
)
-
the " (method (foo)" was just an example of using vars. It's not to be in your code.
-
Do it like this:
(method (handleEvent pEvent)
// right after your method declaration
(var button)
(super:handleEvent(pEvent))
/*****************************************
* Handle the possible said phrases here *
*****************************************/
(if(Said('look'))
//= button
Print("You are in an empty room")
Print(
"Do you want to click Yes or No?"
#title "Click What?"
#font LARGE_FONT
#icon 0 0 0
#button " Yes " 1
#button " No " 0
)
(if(== button 1)
Print("You clicked YES")
)(else
Print("You clicked NO")
)
)
)
)
-
Thanks Brian.
I didn't get an error from compiler this time.
Either I click on yes and no buttons, i got "you clicked yes".
Here the code:
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
// right after your method declaration
(var button)
(super:handleEvent(pEvent))
/*****************************************
* Handle the possible said phrases here *
*****************************************/
(if(Said('look'))
== button
Print("You are in an empty room")
Print(
"Do you want to click Yes or No?"
#title "Click What?"
#font LARGE_FONT
#icon 0 0 0
#button " Yes " 1
#button " No " 0
)
(if(== button 1)
Print("You clicked YES")
)(else
Print("You clicked NO")
)
)
)
)
Robin Gravel
-
Now here, you just want to assign 'button' to the last Print value, e.g.:
= button Print(
"Do you want to click Yes or No?"
#title "Click What?"
.
.
.
-
Thanks Steven. It works.
Robin Gravel