[Repo] JASS H4xx

Level 17
Joined
Apr 27, 2008
Messages
2,453
JASS:
library AwesomeLibrary initializer init // v 1.1.2.3.4.7.4

    globals
        public player Local_player = GetLocalPlayer() // comment this line if you want to use your map, else it will crash on loading
    endglobals

// credit to Captain Griffen for the 2 functions below

    public function TimerAttach takes timer t, real time, real value, code func returns nothing
        call TimerStart(t, value, false, null)
        call PauseTimer(t)
        call TimerStart(t, time, false, func)
    endfunction
    
    // ONLY call on an expired timer.
    public function GetTimerInt takes timer t returns integer
        return R2I(TimerGetRemaining(t) + 0.5)
    endfunction
    
    public function TimerStopPeriodic takes timer t returns nothing
        call PauseTimer(t)
        call ResumeTimer(t)
    endfunction
    
    public function TimerRestart takes timer t returns nothing // on not paused timers
        call ResumeTimer(t)
    endfunction
    
    // when a game is loaded from a save
    public function IsGameLoaded takes nothing returns boolean
        return UnitId2String('hfoo') == null or OrderId2String(851971) == null
    endfunction
    
    // can be used to get and play with units' shadows, last time i check it even completly fuck up selection of units (at least visually)
    public function GetFutureNextImage takes nothing returns image
        local image im = CreateImage("ReplaceableTextures\\Splats\\AuraRune9b.blp",0,0,0,0,0,0,0,0,0,1 )
        call DestroyImage(im)
        return im
    endfunction
    
    // yes all these native GroupEnumUnits...Counted are just the same of the same native function without the extra integer argument
    
    public function GroupEnumUnitsInRangeBJ takes group whichGroup, real x, real y, real radius, boolexpr filter returns nothing
        call GroupEnumUnitsInRangeCounted(whichGroup,x,y,radius,filter,GetRandomInt(0,1337))
    endfunction
    
    public function GroupEnumUnitsInRangeOfLocCountedBJ takes group whichGroup, location whichLocation, real radius, boolexpr filter returns nothing
        call GroupEnumUnitsInRangeOfLocCounted(whichGroup,whichLocation,radius,filter,GetRandomInt(0,1337))
    endfunction
    
    public function GroupEnumUnitsInRectCountedBJ takes group whichGroup, rect r, boolexpr filter returns nothing
        call GroupEnumUnitsInRectCounted(whichGroup,r,filter,GetRandomInt(0,1337))
    endfunction
    
    public function GroupEnumUnitsOfTypeCountedBJ takes group whichGroup, string unitname, boolexpr filter returns nothing
        call GroupEnumUnitsOfTypeCounted(whichGroup,unitname,filter,GetRandomInt(0,1337))
    endfunction
    
    public function IsBlizzardLazy takes nothing returns boolean
        return AbilityId2String('AHds') == null
    endfunction
    
    public function init takes nothing returns nothing
        call CommentString("plz give credits !!!!!")
    endfunction

endlibrary
I may improve it later with more functions.
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,307
wth, if this seriously works, that's awesome

JASS:
    public function TimerAttach takes timer t, real time, real value, code func returns nothing
        call TimerStart(t, value, false, null)
        call PauseTimer(t)
        call TimerStart(t, time, false, func)
    endfunction

However, this is slower than LoadInteger from my tests when I was working on TimerTools
R2I(TimerGetRemaining(t) + 0.5)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Image's brother.
JASS:
function GetNextLightning takes nothing returns lightning
    local lightning l = AddLightningEx("CLPB", true, 0, 0, 0, 0, 0, 0)
    call DestroyLightning(l)
    return l
endfunction
 
Level 17
Joined
Apr 27, 2008
Messages
2,453
It should be the same for texttag, because IIRC there is also no handle reference counter, but as far i know texttags from the game (like the one displayed when gold/wood is collected, or when an unit is hurted by a critical attack, ...) don't share the same stack.
So that would be 100 % useless.
Should be also the same for lightnings.
 
Level 17
Joined
Apr 27, 2008
Messages
2,453
Yeah i've said it was him, not when though or gave the link.
Anyway by creating this thread, i just wanted to highlight silly jass bugs, not getting some people enjoy ...
They are bugs for god sake ...

The only one that i've listed from now which could be used, is for lightning but it's more likely that you will mess up with the internal image stack, maybe if you don't destroy them and only change their color (not tested).
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I have tested before, you can change colors of abilities with lightning effect.But destroying them will crash iirc.
 
Level 17
Joined
Apr 27, 2008
Messages
2,453
But i'm not 100 % sure, maybe i've read it a long time ago (2009 ?) and just remembered randomdly what Deaod said, you know how the brain stores and retrieves information is not always obvious.
So in doubt i will credit him, that isn't like it's an "hard work" anyway.
 
Level 6
Joined
Jan 17, 2010
Messages
149
The wheel was invented before too, you should credit the inventor every time you make something round and spinning.


Btw, I'm still struggling to understand what IsBlizzardLazy does ...



JASS:
 globals
        public player Local_player = GetLocalPlayer() // comment this line if you want to use your map, else it will crash on loading
    endglobals

I think global rect = GetWorldBounds() also crashes...
 
Level 17
Joined
Apr 27, 2008
Messages
2,453
The wheel was invented before too, you should credit the inventor every time you make something round and spinning.

Yep, but hopefully no wheel is involved here.


Btw, I'm still struggling to understand what IsBlizzardLazy does ...

It doesn't work maybe ?
I've used a valid ability rawcode, so it shoudln't return null, anyway check the comment for this function in the most up-to-date common.j lying in your mpq, it will be clear why i've choiced this name.

I think global rect = GetWorldBounds() also crashes...

Probably, i also know that some other functions don't work without any crash, i'm currently too lazy to test all of them, and i usually only write statements that i'm 100 % sure, let's say personnaly tested, or eventually by really reliable people (and i know only one guy).
But don't take me wrong i also sometimes make wrong statements, i just hope i'm much more reliable than the average of people.
 
Top