Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: A GREAT PROBLEM With Global & windows  (Read 3374 times)

0 Members and 1 Guest are viewing this topic.

Viiper87

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
A GREAT PROBLEM With Global & windows
« on: May 15, 2010, 04:25:11 PM »

 Hello developers! Looks like I have find a great hole in your engine.
The problem is:
I have a numbers of global, wich are changeing - this is normal. There are a boolean, integer...
But when I open any window create in WindowEdit (even standart exit menu) ALL my global variables is skips. Booleans, Integers - everything skips to 0, false.
Do you know, what happens?
 ::slug

Thanks. Your engine is pretty good, but this makes me crazy.
______________________________
I used GoExclusive\GoSystemExclusive\ & don't use Exclusive - he doesn't care.
« Last Edit: May 15, 2010, 04:40:13 PM by Viiper87 »
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: A GREAT PROBLEM With Global & windows
« Reply #1 on: May 15, 2010, 04:52:03 PM »

Your problem is totally incomprehensible to me. Could you please rephrase? I use tons of windows and can't confirm any issues like this. Aren't you by any chance doing some base.inc initialization???
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Viiper87

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Re: A GREAT PROBLEM With Global & windows
« Reply #2 on: May 15, 2010, 05:03:27 PM »

Well, I'm some sort of newbie, and all my globals i defined in base.script.
 The problem is - I have counter [global Counter=ToInt();]
when I pick up the object, we have Counter=Counter+1;
But when I open any window, for example I press ESC and press "resume game", my global Count skip to "0", "false". Every of them.
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: A GREAT PROBLEM With Global & windows
« Reply #3 on: May 15, 2010, 05:11:36 PM »

this is totally wrong.

ToInt(x) is for explicit type cast to integer value (sometimes needed when you need to change part of string to integer eg.) but your code would simply set 0 there for every instance of #include "scripts/base.inc"

in base.inc as a rule of a thumb shouldn't be ANY initializing.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Viiper87

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Re: A GREAT PROBLEM With Global & windows
« Reply #4 on: May 15, 2010, 05:17:36 PM »

 Well, thank to explain about base. But a still have a serious problem in understanding of the hierarchy of this engine.
Ofcourse, engine look at #include base. But this "#include" have any active object. And when I, for example, take somth, my Counter don't skip.
 Well, I will trying a litle bit experimenting. Thanks and sorry for Russian logic\syntax.
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: A GREAT PROBLEM With Global & windows
« Reply #5 on: May 15, 2010, 05:25:07 PM »

include is just a shorthand to typing all these commands by yourself. WME has 2 types of variables:

local variable is in the scope of the script and is declared through var
global variable is in the scope of the whole game and must be declared once in every script you're going to reference it. Because for variables like Scene it would be tedious to write it all the time, you have
"global Scene;" in the base.inc. File base.inc is template-wise included in all scripts so you don't have to think again about declaring it by yourself.
 

Another thing is that basically, WME script isn't strongly typed language. You don't have to think about booleans, ints or floats most of the time.

Code: WME Script
  1.  
  2. var a = "Hello ";
  3. var b = 10;
  4. b=b*2;
  5. a = a + b;
  6.  
  7. Game.Msg(a); // prints text Hello 20
  8.  
  9.  

this might help you: http://res.dead-code.org/doku.php/wmebook:ch2
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.036 seconds with 22 queries.