Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Question about include, global variables and a site of scripts.  (Read 8145 times)

0 Members and 1 Guest are viewing this topic.

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP

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
Code: [Select]
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
Code: [Select]
#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:
Code: [Select]
EDIT
  {
     ..
    SCRIPT = "interface\menu\parser.script"
     ..
After start:
 Error. Call to undefined method 'GetWidget.' Ignored.

I have absolutely got confused: (
Logged

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Re: Question about include, global variables and a site of scripts.
« Reply #1 on: August 24, 2005, 07:54:59 AM »

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.
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Question about include, global variables and a site of scripts.
« Reply #2 on: August 24, 2005, 08:27:51 AM »

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
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: Question about include, global variables and a site of scripts.
« Reply #3 on: August 24, 2005, 08:32:55 AM »

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?

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
Re: Question about include, global variables and a site of scripts.
« Reply #4 on: August 24, 2005, 08:55:49 AM »

[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 :(
Logged

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: Question about include, global variables and a site of scripts.
« Reply #5 on: August 24, 2005, 08:59:58 AM »

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?

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Re: Question about include, global variables and a site of scripts.
« Reply #6 on: August 24, 2005, 09:04:33 AM »

#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"
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Question about include, global variables and a site of scripts.
« Reply #7 on: August 24, 2005, 09:07:40 AM »

#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

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
Re: Question about include, global variables and a site of scripts.
« Reply #8 on: August 24, 2005, 09:59:53 AM »

#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"  ;)
Logged

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
Re: Question about include, global variables and a site of scripts.
« Reply #9 on: August 24, 2005, 10:16:00 AM »

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?
Logged

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: Question about include, global variables and a site of scripts.
« Reply #10 on: August 24, 2005, 10:24:26 AM »

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.

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
Re: Question about include, global variables and a site of scripts.
« Reply #11 on: August 24, 2005, 10:40:27 AM »

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.
Logged

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: Question about include, global variables and a site of scripts.
« Reply #12 on: August 24, 2005, 11:46:40 AM »

Fine :-)
 

Page created in 0.024 seconds with 23 queries.