wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-13-2009, 11:31 AM   #31
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

I see. Thanks a lot for clearing things up.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-13-2009, 02:05 PM   #32
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Boolexprs only leak if they are created by And() or Or(). All other boolexprs created with Condition(function X) are actually the same boolexpr and never need to be destroyed or nullified.
__________________
Rising_Dusk is offline   Reply With Quote
Old 11-13-2009, 02:35 PM   #33
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

So if the boolexpr contains or or and then it creates a new boolexpr?
Sounds logical.

So I should really use a local boolexpr, since you can never know what stands in the condition func, because the user can that that.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 11-13-2009, 02:38 PM   #34
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

No ...
Or() and And() are functions, not like "or" , "and"

Collapse JASS:
native Or takes boolexpr operandA, boolexpr operandB returns boolexpr
native And takes boolexpr operandA, boolexpr operandB returns boolexpr

Each time they are called they create a new boolexpr.
But most of the time you just don't need these functions, only for some tricks.

Last edited by Troll-Brain : 11-13-2009 at 02:39 PM.
Troll-Brain is offline   Reply With Quote
Old 11-13-2009, 02:41 PM   #35
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Ah I see. You guys really help me a lot, you can't imaging how many stupid things I have been teached from guys that I thought would have knowledge, but now it seems like most didn't.

So thanks a lot, glad to have you around.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 11-13-2009, 02:57 PM   #36
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Troll-Brain
Each time they are called they create a new boolexpr.
But most of the time you just don't need these functions, only for some tricks.
Yeah, this is right, they don't normally get used except for some boolexpr hackery that is necessary here and again. AutoIndex uses And(), so does that GroupEnumHelper thing we're trying to hammer out in submissions. (For examples)
__________________
Rising_Dusk is offline   Reply With Quote
Old 11-18-2009, 10:28 PM   #37
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

Every 60 seconds of game

pick every item on map with health 0.404 and lower

remove item

this fix everything in easy GUI way...
DioD is offline   Reply With Quote
Old 11-20-2009, 04:20 PM   #38
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Quote:
Originally Posted by DioD
Every 60 seconds of game

pick every item on map with health 0.404 and lower

remove item

this fix everything in easy GUI way...

It's over skilled (sounds funny eh) and anyway i prefer copy/pass a jass code than remake it for each map in gui, even if it's simple and short.
Also, i hate this idea of 60 s.
Troll-Brain is offline   Reply With Quote
Old 03-16-2010, 05:13 PM   #39
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

I've just realized that the wait is completely unneeded.
Even if the trigger of PowerupSentinel is created before an other one defined by the mapmaker, GetManipulated item will return the item, since it won't be already removed.
Ofc if the map maker use a wait the item will be already destroyed, like it should be the case natively anyway.

Here is the new code :

Collapse JASS:
library PowerupSentinel initializer onInit
//* ============================================================================
//*  PowerupSentinel by Vexorian
//*  ------------
//*    Placing this library in your map will automatically fix all rune/tome
//* memory leaks in your map.
//*
//*    Powerup items don't get removed automatically by the game, they instead
//*    just leave a small item in the map, this causes memory leaks but - worse -
//*    it also makes areas of your map where a lot of tomes have been used lag.
//*
//* ===========================================================================
        
    private function Clean takes nothing returns boolean
        if GetWidgetLife(GetManipulatedItem()) == 0 // no you don't need 0.405, you could also use IsItemPowerUp instead
            call RemoveItem(GetManipulatedItem())
        endif
        return false
    endfunction
    
    private function onInit takes nothing returns nothing
        local trigger trig = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DROP_ITEM)
        call TriggerAddCondition(trig,function Clean)
    endfunction

endlibrary

Collapse JASS:
scope SeeItWorks

    private function Show takes nothing returns boolean
        call BJDebugMsg(GetItemName(GetManipulatedItem()))
        return false
    endfunction
    
    private function onInit takes nothing returns nothing
        local trigger trig = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DROP_ITEM)
        call TriggerAddCondition(trig,function Show)
    endfunction

endscope
__________________
Cool != Useful

Last edited by Troll-Brain : 03-16-2010 at 05:43 PM.
Troll-Brain is offline   Reply With Quote
Old 09-11-2010, 03:15 AM   #40
SanKakU
User
 
Join Date: Jan 2009
Posts: 136

SanKakU has a little shameless behaviour in the past (-2)

Send a message via AIM to SanKakU Send a message via MSN to SanKakU Send a message via Yahoo to SanKakU
Default

when i tried to use this with the chargemerger library...and stackitems...
when double right-click the items in the first slot they disappear.

makes me wonder if i should do something like what troll brain suggested.
doing as troll-brain suggested in his last post seemed to fix that bug i ran into.
i might mention though posted code is missing the keyword 'then'

Last edited by SanKakU : 09-11-2010 at 03:33 AM.
SanKakU is offline   Reply With Quote
Old 10-29-2010, 11:43 AM   #41
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

http://www.hiveworkshop.com/forums/j...leanup-175663/ this addresses the issues in PowerupSentinel and deals with it perfectly.
Bribe is offline   Reply With Quote
Old 11-06-2010, 03:42 AM   #42
vuongkkk
User
 
vuongkkk's Avatar
 
Join Date: May 2010
Posts: 5

vuongkkk has little to show at this moment (0)

Default

I'm a newbie. And I have 2 question about PowerupSentinel library:

1: While you must use timer instead of removing item directly
Quote:
call TimerStart(tic,0.0,false,function anon__1)

2: If 2 players pick powerup item (ex:tome of agi) at the same time, you have only one timer. So it may be a leak. Am i right?
vuongkkk is offline   Reply With Quote
Old 11-06-2010, 11:59 AM   #43
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Quote:
Well, as I said, the powerups bug is known but the script in wc3c doesn't fix the leak.
Just put try to put a "BJDebugMsg(GetHandleId)" after the destruction of the item, and you'll see that it is not removed.
This is utter bull :)

Use BJDebugMsg(GetHandleId) after ANY removal of a handle, GetHandleId will work until ALL the variables linking to the handle are set to null (this is the reason we set variables to null). In the first PowerupSentinel version, the array is not set to null until later. (This is because Blizzard creates ghost placeholders after a handle removal so that usage of variables that point to the removed handle don't crash the game or stuff...)

Quote:
1: While you must use timer instead of removing item directly
1. To avoid removing an item before another trigger uses it. But TrollBrain says it is not needed.


Quote:
2: If 2 players pick powerup item (ex:tome of agi) at the same time, you have only one timer. So it may be a leak. Am i right?
Even if two players picked stuff at the same time, the items would be added to the array simultaneously and when the timer expires, it would go to the two arrays.

Quote:
when i tried to use this with the chargemerger library...and stackitems...
when double right-click the items in the first slot they disappear.

makes me wonder if i should do something like what troll brain suggested.
doing as troll-brain suggested in his last post seemed to fix that bug i ran into.
i might mention though posted code is missing the keyword 'then'
I think it might be an issue with those libraries or perhaps this does not recognize powerups correctly. But I will update to use the stuff Troll Brain suggested.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 11-13-2010, 03:45 PM   #44
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

You have to use the "drop" event instead of the "pickup" one.
First, because i suppose it could fail if the mapmaker want to use the "drop" event. I mean maybe the item will be removed before this event fire (not tested).
Secondly, the trigger will fire less times and it's always good.
__________________
Cool != Useful

Last edited by Troll-Brain : 11-13-2010 at 03:46 PM.
Troll-Brain is offline   Reply With Quote
Old 11-13-2010, 07:44 PM   #45
TKF
User
 
TKF's Avatar
 
Join Date: Dec 2006
Posts: 384

TKF is on a distinguished road (10)

Default

Quote:
Originally Posted by Troll-Brain
You have to use the "drop" event instead of the "pickup" one.
First, because i suppose it could fail if the mapmaker want to use the "drop" event. I mean maybe the item will be removed before this event fire (not tested).
Secondly, the trigger will fire less times and it's always good.
Is this true? If so that explains why missile loading bugs in cruiser command.
__________________
Retired
TKF is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 03:09 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services