Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: BUG with ToInt?  (Read 7121 times)

0 Members and 1 Guest are viewing this topic.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
BUG with ToInt?
« on: November 04, 2004, 06:22:18 PM »

Hi,

just a thought, when I create a new array:

global PuzzleArray = new Array(64);
and later access it via:
PuzzleArray[ y * 8 + x] = value;

it works.

If I however make this:

PuzzleArray[ToInt( y * 8 + x)] = value;

engine crashes to desktop

---------------------------------------------------------
---------- WME crash report: 04-11-2004, 18:13 ----------
---------------------------------------------------------
wme.exe caused a EXCEPTION_ACCESS_VIOLATION in module dcscomp.dll at 001B:100037C1
EAX=00000001  EBX=00000001  ECX=00040004  EDX=014EAB58  ESI=00E092D0
EDI=00000001  EBP=00000001  ESP=0012F460  EIP=100037C1  FLG=00010206
CS=001B   DS=0023  SS=0023  ES=0023   FS=0038  GS=0000
Stack trace:
001B:100037C1 (0x00000000 0x00000000 0x00000000 0x00000000) dcscomp.dll

Not, that it's critical for me. Just I am sometimes trying weird things :)
Anyways, is there any way how to create multidimensional arrays? I am right now using my matrix access functions into single dimensional array, but it would be nice if somewhere in future I could make multidimensional matrices.



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

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: BUG with ToInt?
« Reply #1 on: November 04, 2004, 07:11:49 PM »

Um, it's a bug all right :-[
As for the two dimensional arrays, no, it's not possible. The only way is to "emulate" them the way you are doing. Perhaps sometime in the future when I get enough courage to redesign the scripting engine, I'll consider it (and, yeah, it *could* use redesiging, this bug proves it...).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

MMR

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 349
  • http://mmrdeveloper.wordpress.com/
    • View Profile
    • TinyWME
Re: BUG with ToInt?
« Reply #2 on: November 04, 2004, 07:59:19 PM »

Quote
Perhaps sometime in the future when I get enough courage to redesign the scripting engine, I'll consider it (and, yeah, it *could* use redesiging, this bug proves it...).

* Maybe ++ and -- operators ??

* Maybe multiple levels in object accesing methods like... Game.Scene.GetLayer() instead of... var Scene=Game.Scene;  Scene.GetLayer();  ??
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: BUG with ToInt?
« Reply #3 on: November 04, 2004, 08:06:01 PM »

* Maybe ++ and -- operators ??

* Maybe multiple levels in object accesing methods like... Game.Scene.GetLayer() instead of... var Scene=Game.Scene;  Scene.GetLayer();  ??
Yep, precisely!
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: BUG with ToInt?
« Reply #4 on: November 04, 2004, 08:18:34 PM »

Speaking of which. I have a general question regarding my stupidity.

I have this in scene_init.script

global PuzzleArray = new Array(64);

Can I reference this from another scripts?

I thought that the global variable should be visible everywhere. But I am not able to access it from any other script.
Could you just post here a syntax how to access it from elsewhere.

Thanks - most appreciated.

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

vatre

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • vatre the unavoidable
    • View Profile
Re: BUG with ToInt?
« Reply #5 on: November 04, 2004, 08:50:29 PM »

I have this in scene_init.script

global PuzzleArray = new Array(64);

Can I reference this from another scripts?


Yeah, I started working in WME recently and that puzzled me, too.
You gotta define that variable as global again in any other script you wanna use it in, and instead of getting an error or wiping it's data - you will be able to reference it.  ???
I find that a bit weird. :)

Logged
• VatrE •

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re: BUG with ToInt?
« Reply #6 on: November 04, 2004, 09:32:40 PM »

All variables you want to use globally need to be put in base.inc, because it's included in all script files by default (#include "scripts\base.inc")
Logged

MMR

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 349
  • http://mmrdeveloper.wordpress.com/
    • View Profile
    • TinyWME
Re: BUG with ToInt?
« Reply #7 on: November 04, 2004, 10:15:37 PM »

Quote
Yep, precisely!

Great!!
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: BUG with ToInt?
« Reply #8 on: November 05, 2004, 01:24:01 AM »

Thanks everyone. I forgot to mention, that Mnemonic advised me on IRC. :)

Now I am struggling with Dijkstra's algorithm for my puzzle. It's kind of hard to implement with single dimensional array, but I am getting close.

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

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: BUG with ToInt?
« Reply #9 on: November 05, 2004, 08:08:36 AM »

Now I am struggling with Dijkstra's algorithm for my puzzle. It's kind of hard to implement with single dimensional array, but I am getting close.
Can't you use the built-in pathfinding?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: BUG with ToInt?
« Reply #10 on: November 05, 2004, 11:23:27 AM »

well,

this wouldn't probably help me. I have a 8x8 grid and I have some dynamic sprites on it. I need to find if the sprite can slide from one grid square to another in every possible combination of obstacles, depending on users fooling around and moving obstacles. Or is there some more abstract implementation than waypoints?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: BUG with ToInt?
« Reply #11 on: November 05, 2004, 02:42:14 PM »

HAHAHA,

it works. Dijkstra's path finding using single dimensional array only. Now I can port it to WME.
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.053 seconds with 24 queries.