sc2c.org

Go Back   Sc2C.org > Developer's Corner > Scripting
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 08-24-2010, 11:43 PM   #1
Zerzax
Zerzy
 
Zerzax's Avatar
 
Join Date: Aug 2010
Location: U.S.
Posts: 11
Send a message via AIM to Zerzax
Default Objects and Variables in Custom Scripts

My only experience in programming is related to Wc3 and JASS2 and I don't know much about memory allocation in the game. So I'm trying to figure out how to treat objects that are created in local blocks. My guess is that Sc2 doesn't have the same infamous issue that Wc3 did with handles and variables that referenced them. However, I am assuming that objects created in Sc2 still need to be removed or destroyed somehow. There seems to be a pronounced dearth of functions that removes such objects - the only ones I've found are UnitRemove and the function that destroys effects in a radius around a specified point.

What I want to know is:

Does anyone know of more functions that destroy objects like Points, Structs, Effects, etc, that I didn't find?

Or would such functions be unnecessary in this context? Are Points even objects that need to be destroyed? I feel like I'm in the dark here.
Zerzax is offline   Reply With Quote
Old 08-25-2010, 12:10 AM   #2
JademusSreg
Laughs Derisively
 
JademusSreg's Avatar
 
Join Date: Apr 2010
Posts: 112
Default

Garbage collection should be automatic for certain types; when there are no references to these types, they are removed. The types are abilcmd, bank, camerainfo, marker, order, playergroup, point, region, soundlink, string, text, timer, transmissionsource, unitfilter, unitgroup, unitref, waveinfo, and wavetarget, as explained in natives.galaxy in the Core mpq.
__________________
Seek always to excel in whatever you do.
My sense of value is redshifted.
JademusSreg is offline   Reply With Quote
Old 08-25-2010, 02:12 AM   #3
Zerzax
Zerzy
 
Zerzax's Avatar
 
Join Date: Aug 2010
Location: U.S.
Posts: 11
Send a message via AIM to Zerzax
Default

Thank you lots. I'll go check out the file.
Zerzax is offline   Reply With Quote
Old 08-26-2010, 06:25 AM   #4
Tastingo
Junior Member
 
Join Date: Apr 2010
Posts: 22
Default

So if you wanted to garbage them quickly, could you just set them to null? Or does that not really do anything.
Tastingo is offline   Reply With Quote
Old 08-26-2010, 06:41 AM   #5
JademusSreg
Laughs Derisively
 
JademusSreg's Avatar
 
Join Date: Apr 2010
Posts: 112
Default

Every reference to them would need to be set to null (or the equivalent for its type). If it's stored in multiple variables, you might find that problematic, depending on how the script is designed.
__________________
Seek always to excel in whatever you do.
My sense of value is redshifted.
JademusSreg is offline   Reply With Quote
Old 08-27-2010, 09:20 PM   #6
Zerzax
Zerzy
 
Zerzax's Avatar
 
Join Date: Aug 2010
Location: U.S.
Posts: 11
Send a message via AIM to Zerzax
Default

Looks like you just have to keep good track of your vars, keep things individual to their scopes, etc. I definitely prefer the "new way" to manually destroying most things, though perhaps JASS2 was good practice.

Last edited by Zerzax : 08-27-2010 at 09:24 PM.
Zerzax is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump


All times are GMT. The time now is 01:50 PM.


Powered by vBulletin
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.