Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: HIman on August 24, 2005, 07:36:56 AM
-
Greetings!
Three questions, I in fact only study:)
The first:
In an example wme_demo
From interface\menu\menu.script
In scripts\base.inc
Has transferred a line global MenuObject,
Mistakes are not present but after start the black screen, why?
The second question:
In an example wme_demo after successful insert Edit in
interface\menu\menu.window
Example of a code
EDIT
{
NAME = "desc"
BACK = "ui_elements\editor.image"
FONT = "fonts\outline_green.font"
FONT_SELECTED = "fonts\outline_red.font"
SCRIPT = "scripts\parser.script"
X = 0
Y = 100
WIDTH = 250
HEIGHT = 20
FRAME_WIDTH = 4
TEXT = " "
MAX_LENGTH = 200
PARENT_NOTIFY = TRUE
CURSOR_BLINK_RATE = 300
}
Has created scripts\parser.script with a code
#include "scripts\base.inc"
#nclude "scripts\keys.inc"
var Editor = self. GetWidget ("desc");
Editor. Text = self.xDescription;
Editor. SelStart = 0;
Editor. SelEnd = 200;
on "Keypress"
{
self. Close ();
if (Keyboard. KeyCode == VK_RETURN)
{
actor. Talk (Editor. Text);
}
MenuObject = null;
}
error opening script 'interface\menu\parser.script'
Why? I have obviously specified a way and what script will process EDIT.
The third question:
I have created parser.script in 'interface\menu\parser.script' with code look above.
Has specified what script will be will be executed:
EDIT
{
..
SCRIPT = "interface\menu\parser.script"
..
After start:
Error. Call to undefined method 'GetWidget.' Ignored.
I have absolutely got confused: (
-
I can't understand what you're asking in your first question, but I can see two mistakes in your parser.script, which may very well be causing the error you're getting.
First is you typed '#nclude "scripts\keys.inc"' instead of "#include "scripts/keys.inc". Also, you left a space when calling the method GetWidget from the self object, it should look "self.GetWidget("desc");". Same with the next functions, Editor.Text, Editor.SelStart, etc.
-
Ok. to clarify, it's equal if you use
#include "something/something" or #include "something\something"
Both will work.
the space is really a big mistake and also you should use "this" instead of "self".
If you are still confused about variables and objects you can check out my short tutorial on them:
http://wiki.dead-code.org/wakka.php?wakka=ObjectsVariables&v=k95
Hope that helps
-
The first:
In an example wme_demo
From interface\menu\menu.script
In scripts\base.inc
Has transferred a line global MenuObject,
Mistakes are not present but after start the black screen, why?
If I get you right you copied global MenuObject from your menu.script to base.inc? If yes, check if global MenuObject is defined in a script that includes base.inc, in that case it would be defined twice which I causes an error.
Does WME.log give out any errors?
-
[If I get you right you copied global MenuObject from your menu.script to base.inc? If yes, check if global MenuObject is defined in a script that includes base.inc, in that case it would be defined twice which I causes an error.
Does WME.log give out any errors?
global MenuObject it is determined only once.
It would be quite good to add search in WME Project Manager ::)
I have not copied, and have transferred definition of a variable
From interface\menu\menu.script
In scripts\base.inc
Mistakes in WME.log are not present, but does not work :(
-
I have just looked at the wme-demo, and MenuObject is also defined in Game.Script which includes base.inc - did you delete it there?
-
#include "something/something" or #include "something\something"
Both will work.
Alright, that was a mistake of mine, but I was pointing at the "inculde" vs. "nclude"
-
#include "something/something" or #include "something\something"
Both will work.
Alright, that was a mistake of mine, but I was pointing at the "inculde" vs. "nclude"
Ah, and I am blind. LOL
-
#include "something/something" or #include "something\something"
Both will work.
Alright, that was a mistake of mine, but I was pointing at the "inculde" vs. "nclude"
Thanks for "ncude" but it only a mistake in a forum and in the program "include" ;)
-
I have just looked at the wme-demo, and MenuObject is also defined in Game.Script which includes base.incĀ - did you delete it there?
Is not present did not delete, after change in scripts\game.script
global MenuObject = null;
On
MenuObject=null;
Works, but then the question remains as it turns out that has been determined two times a global variable in WME_demo?
-
I'm not sure if I got you right, but anyway: A global variable must be defined in every script you use it, but only once per script - just like normal variables. So if you define your variable in an .inc-file and include it in a script, for example scene_init.script, you can't define the same varaible in that script again.
-
I have understood all... Thanks metamorphium and him
tutorial http: // wiki.dead-code.org/wakka.php? wakka=ObjectsVariables*v=k95
>>>>>>>>>
!!This is important! If you use global variables they MUST be declared using the global keyword in every script you are using them. Otherwise it won't work and you will end up with script compiler errors.
-
Fine :-)