• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Crash] World Editor Crashes on hash tables

Status
Not open for further replies.
Level 3
Joined
Feb 19, 2016
Messages
32
Hey.
I try to add a region handle into my hashtable. But when I want to save handle of the region trough GUI(Hashtable - Save region), application stops responding and crashes. The same thing goes with unit groups.
Any ideas what is the cause of this?
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
You the custom script action in GUI and use these JASS functions:

JASS:
native SaveRegionHandle takes hashtable table, integer parentKey, integer childKey, region whichRegion returns boolean

native LoadRegionHandle takes hashtable table, integer parentKey, integer childKey returns region
 
Level 25
Joined
Sep 26, 2009
Messages
2,384
There are some things incorrectly implemented for the hashtable. The same thing happens with ability handle.
My guess is that it is supposed to take in a region (jass region), not the rectangular region you're writing about (called rect in jass).

Edit:
Just got back from testing to see people answered earlier than I did.

You the custom script action in GUI and use these JASS functions:

JASS:
native SaveRegionHandle takes hashtable table, integer parentKey, integer childKey, region whichRegion returns boolean

native LoadRegionHandle takes hashtable table, integer parentKey, integer childKey returns region
That is incorrect. Jass region != GUI region. Instead, Jass rect == GUI region.

But yeah, Emm-A basically got it right. It does work if you use jass script.
Check the attached test map to see how it's done.
 

Attachments

  • HashtableRegion.w3x
    16.7 KB · Views: 41
Level 14
Joined
Jul 1, 2008
Messages
1,314
Sry, but also in GUI trigger editor, a region is a region and a rect is a rect. There is a SaveRectBJ and a SaveRegionBJ ...

If you use the SaveRectBJ in GUI, it does not crash the WE in contrast to SaveRegionBJ. Thats why the 2 natives I posted, are the correct solution for his problem, and you should not mix up definitions for the sake of clarity.
 
Level 25
Joined
Sep 26, 2009
Messages
2,384
There may have been slight misunderstanding. What I meant as GUI region was everything region-related in GUI (e.g. move region, set point at region, region palette, etc.), just now, after reading your post I checked and saw that there is actually an action in the hashtable list for also saving a rect.

So if you meant that GUI region == Jass region in the hashtable menu, then you are correct. If not, you are incorrect and I can easily prove that to you.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
It is a bug from when they introduced hashtables. They thought that the "ability type" and "region" JASS types were the same as their corresponding GUI types, which they are not. In GUI an "ability type" is actually an integer while a "region" is a rect. The crash occurs because it tries to access a type which does not exist in the GUI editor and such a case is not handled gracefully.

The solution, and recommendation, is to move to pure JASS since frankly the WE GUI editor is terrible.
 
Status
Not open for further replies.
Top