• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Referencing GUI-created regions/rects in JASS/Lua code

Status
Not open for further replies.
Level 2
Joined
Jul 2, 2012
Messages
5
Using World Editor version 1.34

---
Solution - Each GUI Region is a JASS rect. Each GUI Region (JASS rect) can be referenced in JASS with a generated global variable of the form gg_rct_REGION_NAME, where "REGION_NAME" is the Region's name as it appears in the GUI Region Palette and Object Manager, just replace any spaces with underscores.

What's confusing is that, despite region and rect being two different native objects in JASS, a GUI Region is in fact a JASS rect.
---


Suppose I have a region named "My Region" that I created in the GUI with the Region palette. How can I reference this region or its rect(s) in JASS or Lua?

I see that I can easily reference the region in a variety of GUI trigger commands, such as the 'A unit enters a Region' event, for example:
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters My Region <gen>
    • Conditions
    • Actions
      • Custom script: print('hello world')
But how can I directly reference this region in code? I think its generated variable name is something like "gg_rct_Region_000", or maybe it's "gg_rct_My_Region" - how can I use this information to get a usable native object?

Ultimately, I need to reference a rect (region) for use with this common.j method: GroupEnumUnitsInRect

Again, the Region name is known beforehand - I just need a way to reference it and use it as a native object.
 
Last edited:
Status
Not open for further replies.
Top