- Joined
- Sep 26, 2009
- Messages
- 9,514
How would GUI users benefit? Not unless they coded in JASS really.
//! zinc
library Benchmark {
//Test results (Azlier):
// Or: 13.8 fps
// TriggerAddCondition: 13.9 fps
constant real TICK = 0.01;
constant integer COND_COUNT = 1500;
constant boolean USE_OR = true;
trigger Trig = CreateTrigger();
boolexpr Cond = null;
code Dummy;
function DummyFunc () {}
function Execute () {
TriggerEvaluate(Trig);
}
function AddConds () {
integer i = COND_COUNT;
while (i != 0) {
i -= 1;
if (USE_OR) {
if (Cond == null) {
Cond = Condition(Dummy);
} else {
Cond = Or(Cond, Condition(Dummy));
TriggerClearConditions(Trig);
}
TriggerAddCondition(Trig, Cond);
} else {
TriggerAddCondition(Trig, Condition(Dummy));
}
}
}
function BeginTest () -> boolean {
TimerStart(CreateTimer(), TICK, true, function Execute);
DestroyTrigger(GetTriggeringTrigger());
return false;
}
function onInit () {
trigger t = CreateTrigger();
Dummy = function DummyFunc;
AddConds.evaluate();
TriggerRegisterPlayerEvent(t, GetLocalPlayer(), EVENT_PLAYER_END_CINEMATIC);
TriggerAddCondition(t, function BeginTest);
t = null;
if (USE_OR) {
DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Test: Or.");
} else {
DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Test: TriggerAddCondition.");
}
DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Press Esc to begin the test.");
}
}
//! endzinc
Another benefit to using this is that you can allow your functions to return nothing (it doesn't crash Mac computers any more). pJass won't let Filter(function thatReturnsNothing) parse but if you first pass the code argument as a variable and then pass the code argument to the Filter it compiles just fine.
Therefore we can stop with the spamming of "return false" once and for all! Hah hah hah hah hah (evil victorious laugh).
Another benefit to using this is that you can allow your functions to return nothing (it doesn't crash Mac computers any more). pJass won't let Filter(function thatReturnsNothing) parse but if you first pass the code argument as a variable and then pass the code argument to the Filter it compiles just fine.
Therefore we can stop with the spamming of "return false" once and for all! Hah hah hah hah hah (evil victorious laugh).
Another benefit to using this is that you can allow your functions to return nothing (it doesn't crash Mac computers any more). pJass won't let Filter(function thatReturnsNothing) parse but if you first pass the code argument as a variable and then pass the code argument to the Filter it compiles just fine.
Therefore we can stop with the spamming of "return false" once and for all! Hah hah hah hah hah (evil victorious laugh).
Or, you can hook IssueOrder functions :x (Only 8-9 hooks if you're not using BJs/GUI)
Who cares about natural orders? You know they're being ordered as you go along so displaying them is useless.
So plz admit that in some cases the multiple triggers is the only way to go (i'm not saying it happens that many times though)
Magtheridon96 said:Multiple triggers are the way to go in every case
function RegisterPlayerUnitEventForPlayer takes playerunitevent p, code c, player pl returns nothing
/*
* - function RegisterPlayerUnitEvent
*/
/*
* - function RegisterPlayerUnitEventForPlayer
*/
Don't worry, backwards compatibility is NOT broken, I just added a new function
Pff, that's not fun :/
GetSpellAbilityId() == SPECIFIC_ABIL
constant playerevent EVENT_PLAYER_STATE_LIMIT = ConvertPlayerEvent(11)
constant playerevent EVENT_PLAYER_ALLIANCE_CHANGED = ConvertPlayerEvent(12)
constant playerevent EVENT_PLAYER_DEFEAT = ConvertPlayerEvent(13)
constant playerevent EVENT_PLAYER_VICTORY = ConvertPlayerEvent(14)
constant playerevent EVENT_PLAYER_LEAVE = ConvertPlayerEvent(15)
constant playerevent EVENT_PLAYER_CHAT = ConvertPlayerEvent(16)
constant playerevent EVENT_PLAYER_END_CINEMATIC = ConvertPlayerEvent(17)
function RegisterPlayerUnitEventForPlayer takes playerunitevent p, code c, player pl returns nothing
local integer i = @260@ /* Needs to be 277 */ + 16 * GetHandleId(p) + GetPlayerId(pl)
if t[i] == null then
set t[i] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t[i], pl, p, null)
endif
call TriggerAddCondition(t[i], Filter(c))
endfunction