1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[vJASS] SyncInteger

Discussion in 'JASS Resources' started by TriggerHappy, Apr 30, 2016.

  1. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
  2. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    The global array integer is not necessary (i know i wrote it).
    I mean, you can do the math inside the loop.
     
  3. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,182
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    I find it okay to use the power global. I tried it myself and system works good, approved.
    I removed the ".. and SyncString" from thread's name.
     
  4. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Update
    • Re-worked how the system utilizes UnitDex. When detected, a variable will store the units value instead of SetUnitUserData
    • No longer preloading power values, the math is done within the loop
    • Removed SyncSelections hook
     
  5. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Update - v1.0.9
    • The system now only de-selects a unit if the player's unit selection is full. This fixes a bug (in most cases) where it would cancel the mouse when trying to order a unit.
    • In SyncTerminate, SelectionGroup is now destroyed when GroupUtils is not found, and references to SyncString removed.
    • Incremented the dummy assigned value by 1 to avoid a value of 0.
    • Local player cached.
    • Added optional xebasic and optional PlayerUtils requirements.
     
  6. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Update - v1.0.10
    • Added SyncNotify and SyncNotifyAddUnit which allow you to use a custom dummy unit to trigger a sync event.
    • Constants made public.
     
    Last edited: Feb 28, 2017
  7. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Update - v1.1.0
    • SyncInteger & SyncNotify now take
      player
      instead of
      integer
      for player id.
    • Reworked notification system. The dummy unit is now created internally and you are given a notification id.
    • Can now use any unit indexer (or still none).
    • Cleaned up debugging messages.
    • Dummy units are created specifically at map boundaries instead of at some random large coordinates.
     
  8. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,182
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Code (vJASS):
    function SyncNotifyCreate takes nothing returns integer
    function OnSyncNotify takes filterfunc func returns nothing
    function RemoveNotifyEvent takes triggercondition action returns nothing

    ^You might have forgotten to add them to API docu.
     
  9. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Update - v1.1.1
    • Dummy units are now hidden.
    • Updated/fixed documentation.
    I think the next version may include an option for increased performance with
    IsUnitSelected
    rather than the selection event.
     
  10. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Updated: v1.2.0

    • struct SelectionSync
      implemented which allows the user to create new instances of the system. Previously, you could only work with a single instance which was prone to conflicts if multiple scripts used this library.
    • Added
      function GetSyncedInstance
      which returns an instance of
      SelectionSync
      that is associated with the synced data.
    • function GetSyncedPlayerId
      implemented which allows you to get the syncing player by their index.
    • Configuration boolean
      DEFAULT_INSTANCE
      added, which when true will create a default instance of the system for use with the
      SyncInteger
      function (provides backwards compatibility).
    • Removed the functionality for notifications which allowed you to signal when a process was complete with a single selection.
    • The system is now initialized from a module.
     
    Last edited: Aug 8, 2017
  11. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,667
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Update - v1.2.1
    • You can no longer manually select dummy units by scrolling your camera towards the map boundaries and drag-selecting. This could cause problems if you selected the dummy while data was syncing. It wasn't an issue if you used a dummy with an unselectable model, but now it works properly with any default unit.
    • DUMMY_ABILITY
      constant removed.