GUI custom scripts

emjlr3

Change can be a good thing
Reaction score
397
if anyone could hlep me with this, im trying to got throguh my triggers an d get rid of all leaks, by using the basic sutom scripts

if people could just maybe tell me what the most commmon ones are and what they do and maybe an example of using them that would be very helpful

right now I jsut started with this

Code:
Custom script:   call DestroyTrigger( GetTriggeringTrigger() )

I am going through and adding that to then end of all my triggers that run only once, as I have read that it is effective for doing...stuff


now im going through and setting teh temp postion variable as the place I want my dummy units to be created, then

Code:
Custom script:   call RemoveLocation( udg_Temporary_Point )

after they are created


ok I did that for all units and special effects


now on to a few questions, how bad does creating a unit, and giving it an expiration timer to destroy it, leak, and what about special effects that destory them selves, like flamestrike, if you dont remove those how bad to they leak?

and what is this about unit groups leaking?

other then that I dont believe I should have any other leaks
 
- expiration timer:
When you give a unit expiration time, the unit dies when its time is over. When a unit dies game play its death animation and wait untill decay time, then create a coprse and wait untill corpse decay time and totaly remove them from game. If you want a quick soltion remove dummy units from game instantly after their job finished. But they will also be removed with expiration time too however this will take some time.

- special effcects
Mate thats just a sentence to put there. Destroy your effects even they seems to be get destroyed.

- group leaks
When you say pick all units in playable map area game creates 1 object for each picked unit in playable map area and holds them in another group object untill u destroy it.

To remove-destroy this leaks take a look at common.j functions on Jass:
http://jass.sourceforge.net/doc/api/common_j-functions.shtml
you will find all needed scripts there however here are some common used ones:

for unit objects: you need to store them in variables. If you want to get rid of from units just use:
Code:
Custom script:   call RemoveUnit(udg_Your_Variable)

for region objects: you will use that functions when you created a region such as region centered around caster width height or when you say playable map area forexample. And you Must keep this objects in variables
Code:
Custom script:   call RemoveRect(udg_Your_Variable)

for point objects: you will use that when you say positioon of unit , abilitiy being cast polarprojection and all functions that are retuns a position/point/location
Code:
Custom script:   call RemoveLocation(udg_Your_Variable)

for group objects: as i said above you must keep them in variables and destroy them immedeately after its usage finished
Code:
Custom script:   call DestroyGroup(udg_Your_Variable)

as you understand from the structure we use:
Code:
Custom script:   call [B]functionName[/B](udg_Your_Variable)

so quick ones
-for lightining effects: DestroyLightning
-for floating texts: DestroyTextTag
-for countdown timers: DestroyTimer

however we sometimes need some objects after our spell or trigger action finished such as Casting unit or any Target unit or a region ect destroyin and removing this objects will totaly removes them from game. but when we set a caster to a variable our caster object will also be in this variable and will leak memory. But at least we can clear the data holded by this variable by using:
Code:
Custom script:   set udg_Your_Variable = null

good luck
 
ty for that, let me sure I go this straight, after setting something to a variable, whe nit is done being used you should set the variable to null?

so say i do Set Temporary_Point = (Position of (Triggering unit))

create a dummy at Temporary_Point,
then do Custom script: call RemoveLocation( udg_Temporary_Point )
now after this do I have to do
Custom script: set udg_Temporary_Point = null???(if so this would have to be done everytiem you set a variable to right?)
then I will Wait 0.50 seconds
while letting the dummy do his stuff (I put this in because It seems if you create the unit, order it do cast the spell, then immediatly remove it then it never casts the spell, so there needs to be a little time there, adn this is the only way I can think to do it)
remove the dummy from game by like
Unit - Kill (Last created unit)
Unit - Remove (Last created unit) from the game

all that should make sure there are no leaks there, correct?


what is the best way to destroy effects that need to wait for the whole effect before they can be destoryed without stopping the effect?

the only thing I can think to do it to store each into an effect array, then add a wait time, then destroy them each after they are done playing


then when creating a group, first set a variable as the group
Set grger = (Units in (Playable map area) owned by Player 1 (Red))

have them do what is needed, then do
Custom script: call DestroyGroup(udg_grger) or would I do
Custom script: call RemoveRect(udg_grger)
then again would I need to
set udg_grger = null?

anywho ty mucho for your continued help!
 
emjlr3 said:
ty for that, let me sure I go this straight, after setting something to a variable, whe nit is done being used you should set the variable to null?

so say i do Set Temporary_Point = (Position of (Triggering unit))

create a dummy at Temporary_Point,
then do Custom script: call RemoveLocation( udg_Temporary_Point )
now after this do I have to do
Custom script: set udg_Temporary_Point = null???(if so this would have to be done everytiem you set a variable to right?)
You dont need to null global variables only locals, ofcourse you will save a tiny amount of memeory but think of it you have like 20 globals? And 1 unnulled variable leaks 4 bytes or sumting that isnt very much. The problems is with locals that is 'created' every time the function runs.


emjlr3 said:
then I will Wait 0.50 seconds
while letting the dummy do his stuff (I put this in because It seems if you create the unit, order it do cast the spell, then immediatly remove it then it never casts the spell, so there needs to be a little time there, adn this is the only way I can think to do it)
remove the dummy from game by like
Unit - Kill (Last created unit)
Unit - Remove (Last created unit) from the game

all that should make sure there are no leaks there, correct?
It is better to add a experation timer to the unit as soon as it is created and then order it to cast. You dont need any waits at all. A unit that dies is automaticaly cleaned from memory (after its decay, or instant if it has no decay).


emjlr3 said:
what is the best way to destroy effects that need to wait for the whole effect before they can be destoryed without stopping the effect?

the only thing I can think to do it to store each into an effect array, then add a wait time, then destroy them each after they are done playing
The only way to do that in a good way is to use locals. Read some tutorials and stuff they arnt that hard tu use.

emjlr3 said:
then when creating a group, first set a variable as the group
Set grger = (Units in (Playable map area) owned by Player 1 (Red))

have them do what is needed, then do
Custom script: call DestroyGroup(udg_grger) or would I do
Custom script: call RemoveRect(udg_grger)
then again would I need to
set udg_grger = null?

anywho ty mucho for your continued help!

Custom script: call DestroyGroup(udg_grger) is the only thing you need.

RemoveRect is for GUI regions, wich are called rects in jass. There is something called regions in jass to but that is something else ^^
 
aight got how to fix the group leaks by just removing them when done, and for removing units, jsut give em the expiration timer, and make them have no decay?

sounds good to me! :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Happy Thursday!
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper
  • Stephen Stephen:
    Oh no - please don't lose the Nuon content
    +1
  • The Helper The Helper:
    Someone email AtariAge and see if they want me to transfer the forum data over to it
  • Ghan Ghan:
    Could probably keep NUON stuff around here if we wanted.
  • Ghan Ghan:
    Hmm what to do about the World Editor site though?
  • Stephen Stephen:
    I'd rather personally just own a backup of the Nuon data than see it go to AtariAge honestly. If it gets enshittified as per usual, or if some of the "regular" Jaguar folks get there, it's not gonna be fun
  • The Helper The Helper:
    There will be a github of the forum data so the NUON Forum Data I guess would be available there
  • The Helper The Helper:
    World Editor is technically Ryoko stuff not mine you guys can keep that I am not in that even
  • jonas jonas:
    :( end of an era :(
  • The Helper The Helper:
    Dont think of it as an end jonas - think of it as a beginning, because really my friend that is what it is.

The Helper Discord

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top