1. Are you planning to upload your awesome tool to Hive? Please review the rules here.
    July 9, 2018: The rules for the Tool Section have been revised. Please be sure to read the revisions.
    Dismiss Notice
  2. 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
  3. 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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Let your favorite entries duke it out in the 15th Techtree Contest Poll.
    Dismiss Notice
  5. Weave light to take you to your highest hopes - the 6th Special Effect Contest is here!
    Dismiss Notice
  6. 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.

Reactive Extension for Warcraft 3 Lua

Submitted by G_Freak45
This bundle is marked as pending. It has not been reviewed by a staff member yet.
I have started work on RxW3, a port of RxJS/RxLua to be used with Warcraft 3
This particular way of development is far more intuitive to the way that event based programming is done than the trigger based functional programming we are used to.

It is still a work in progress, I am working on the fromEvent helper function as there is a lot of information that will need to go into it.

Example of code being written using the typical trigger/condition format:

Code (Text):
function StartEffectOfAbility()
    local trigger = CreateTrigger()
    TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    TriggerAddAction(trigger, function()
        local caster = GetTriggerUnit() --GetTriggerUnit references the Triggering Unit
        if GetSpellAbilityId() == FourCC('AUan') then --If the ability being cast is equal to Animate Dead
            KillUnit(caster) --Kill the triggering unit (casting unit) to show that it worked
        end
    end)
end
Here is the same example using RxW3:


Code (Text):
local Observable = importWM('RxW3', 'Observable');
local filter = importWM('RxW3', 'Operators/Filter');
local EVENT_TYPE_ANY_UNIT = importWM('RxW3', 'Events/AnyUnit');

Observable.fromEvent(EVENT_TYPE_ANY_UNIT, EVENT_PLAYER_UNIT_SPELL_EFFECT):pipe(
    filter(function (args) return args[1] == FourCC('AUan') end), --Filter for the animate dead ability (event args used to get spell ability id instead)
):subscribe(function (args) KillUnit(args[0]) end); --Kill the triggering unit (casting unit) to show it worked (event args used to get caster instead)
Github:
elliotmendiola/RxW3
Contents

Reactive Extension for Warcraft 3 Lua (Binary)

  1. G_Freak45

    G_Freak45

    Joined:
    Jan 27, 2011
    Messages:
    11
    Resources:
    0
    Resources:
    0
    I am continuing to update this, do not download directly from hive, get from github if you want to use it, also feel free to install using WLPM
     
  2. yxq1122

    yxq1122

    Joined:
    Jun 5, 2018
    Messages:
    144
    Resources:
    0
    Resources:
    0
    Thank you for trying to improve the coding experience! Please continue this meaningful work.
     
  3. G_Freak45

    G_Freak45

    Joined:
    Jan 27, 2011
    Messages:
    11
    Resources:
    0
    Resources:
    0
    Don't thank me yet, still a work in progress

    Need to get more testing, demos, etc