• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] Global Regions

Status
Not open for further replies.
Level 12
Joined
Apr 27, 2008
Messages
1,228
I tried adding rects to global regions and wc3 crashed every time that was done.
(yes I am sure it was from adding a rect to a global region)
I wonder if this is normal and/or is there a way to avoid the crash while using a global region?
P.s. My region is defined in a globals vJass block.
 
You assume correct.
The code is not specific, but here is an example:
JASS:
globals
    region r=CreateRegion()
endglobals
function something takes nothing returns nothing
    call RegionAddRect(r, gg_rct_rect000)
endfunction
I just wonder :)
This is easily avoidable(in my case).
But it would be good if I and anyone who saw this thread knew whether this causes problems.
 
Lol...
You seem to have very limited knowledge of vJass(if any).
gg_rct_rect000 is a rect created in the WE(main window; Somehow I thought that would be clear to anyone who has used rects created that way).
 
Lol...
You seem to have very limited knowledge of vJass(if any).
gg_rct_rect000 is a rect created in the WE(main window; Somehow I thought that would be clear to anyone who has used rects created that way).

i had already with vJass a bug save compilation so it's not very funny xD

Oh and maybe you can't use the native CreateRegion() directly with declare the variable.
I know you can't do it for all natives functions but dunno which ones exactly.
 
That may be so, but game crashes when I add the rect - if I do not add it, game does not crash.
 
But maybe the region is still not created.

Did you try that :

JASS:
library MyLibrary initializer init

   globals
       region R
   endglobals

   public function init takes nothing returns nothing
      set R= CreateRegion()
   endfunction

endlibrary

function something takes nothing returns nothing
    call RegionAddRect(R, gg_rct_rect000)
endfunction
 
Troll-Brain is on the same track, it is crashing when initializing a rect or a region the same time you create the global.(the rect was added for info, since that thing happend me once).

Thus, I found this to work.
JASS:
globals
    region r
endglobals

function test takes nothing returns nothing
    set r = CreateRegion()
    call RegionAddRect(r, gg_rct_rect000)
endfunction
Its kind of the same as Troll-Brain did ._. I noticed that after, sorry for that
 
So it's because you can't use the native CreateRegion and Rect the same time you create the variable.
If you really want to know why, ask blizzard.

Personally i avoid using natives in a declaration of a global variable.
I know it works for CreateTimer and CreateTrigger, but i don't want test the other natives, so i always use an initializer function.
 
Status
Not open for further replies.
Back
Top