1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Merge regions

Discussion in 'Triggers & Scripts' started by Gjallarhorn, Feb 10, 2009.

  1. Gjallarhorn

    Gjallarhorn

    Joined:
    Feb 1, 2009
    Messages:
    107
    Resources:
    0
    Resources:
    0
    Quite simply, how do I merge regions using JASS? :)
    Describing it better: Taking Reg1, Reg2 and Reg3 and making them work as a single region
     
  2. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    871
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    Well since Regions and Rects are not the same and WE describes Rects as Regions in GUI. What you need to do is add you rect to a region with a native calle
    Code (vJASS):
    RegionAddRect takes region A, rect B returns nothing


    So, if you have a global region that you add your rects to it would work
     
  3. Gjallarhorn

    Gjallarhorn

    Joined:
    Feb 1, 2009
    Messages:
    107
    Resources:
    0
    Resources:
    0
    Sorry, I just started using JASS... can you describe it a little bit more?

    First of all, I don't know what a Rect is. If I draw a region with the region pallete, how do I know it's a rect or region?
     
  4. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    A rect and a region are one and the same. Rect is just what JASS calls them.
     
  5. Eleandor

    Eleandor

    Joined:
    Aug 21, 2005
    Messages:
    3,681
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    To be more precise:

    A "rect" in jass is a GUI region (as well as the regions you make through the region palette).
    A "region" in jass is an "area" that can contain specific rects and points.

    However, when you use the "Unit enters region" event, you are in fact using jass regions, and not gui regions (i.e. rects). If you use that GUI action on a gui region, the rect is converted into a region (through creating a new region and adding the rect to the region)
     
  6. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    871
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    Excactly what i was trying to say :D
     
  7. Gjallarhorn

    Gjallarhorn

    Joined:
    Feb 1, 2009
    Messages:
    107
    Resources:
    0
    Resources:
    0
    That's cool! I understand it now. I'll probably have to learn how to add rects to regions, though. Maybe setting a region variable using JASS, and adding the rects to that variable? If I do it like this, all my "unit enters (region)" events will need to be done in JASS too, right? Or can I do it in GUI and set the (region) to the variable I created using JASS?
     
  8. Element of Water

    Element of Water

    Joined:
    Aug 3, 2008
    Messages:
    2,298
    Resources:
    5
    Spells:
    3
    Tutorials:
    1
    JASS:
    1
    Resources:
    5
    No all of your events will have to be done in JASS. My advice is, don't use GUI in JASS. Use JASS in GUI by all means, to remove leaks which can't be removed with plain GUI, but don't put loads of custom scripts in a GUI trigger, effectively making it JASS. It just looks ugly. Either stick to JASS or GUI (I'd recommend JASS).
     
  9. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    871
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    So true.. :D
     
  10. Element of Water

    Element of Water

    Joined:
    Aug 3, 2008
    Messages:
    2,298
    Resources:
    5
    Spells:
    3
    Tutorials:
    1
    JASS:
    1
    Resources:
    5
    wondering what you gave me rep for but thanks anyways :p have some back :D
     
  11. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    871
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    You recommended him something and gave him a really good tip, it deserves a rep, in my opinion
     
  12. Element of Water

    Element of Water

    Joined:
    Aug 3, 2008
    Messages:
    2,298
    Resources:
    5
    Spells:
    3
    Tutorials:
    1
    JASS:
    1
    Resources:
    5
    Ok then, not complaining :D