Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Recycling Strings?
Recycling Strings?
Jan 22 2013, 9:13 am
By: Leeroy_Jenkins  

Jan 22 2013, 9:13 am Leeroy_Jenkins Post #1



I've reach the string limit in my map, I'm wondering how I can clean some up to make some more room because I've heard that's a thing...



None.

Jan 22 2013, 1:57 pm Roy Post #2

An artist's depiction of an Extended Unit Death

If you don't use SCMDraft exclusively, it's not recommended that you recycle strings (as it can cause issues when going between editors that do not support it). Instead, your only option would be to remove strings. Delete custom switch names, trigger comments, display text messages, custom unit names, mission briefing texts, location names, etc. to get rid of strings.

If SCMDraft is the only editor you use, all you need to do is give the strings the same name, and SCMDraft will recycle the string for you. A common tactic regarding trigger comments is to have a comment-trigger (a trigger that just holds a Comment action in it) that describes what a group of triggers is about (e.g., "Location Grid Scanning"), and all related triggers below it have a comment that's just a single space in it. Example:


Personally, I prefer to name all the triggers using the same string (which is just as efficient since SCMDraft recycles the string), but it all comes down to preference. Just remember: use the exact same string, and SCMDraft will take care of the rest.




Jan 22 2013, 3:43 pm Oh_Man Post #3

Find Me On Discord (Brood War UMS Community & Staredit Network)

You can use WinMPQ to rename all your WAVs to names that use less strings, however you have to manually change the new WAV name in the trigger list and recompile.

Also if you are using lots of spacebars for indentations swap that out with a TAB instead.
Also if your set up is like this:
Display Text Message:
SPACEBAR
SPACEBAR
SPACEBAR etc.
[Text]

Change it to:
Display Text Message:
Spacebar
Display Text Message:
Spacebar, etc.
Display Text Message:
Text

And you will save more strings.
Also if you are using dialogue from named characters you can save more strings instead of
Display Text Message:
[Character Name:]
[Text]

change to
Display Text Message:
[Character Name:]
Display Text Message:
[Text]

Also you can use colour bleeding to save strings for same words with different colours:
So instead of:
DTM
<04>Sword
DTM
<06>Sword
DTM
<07>Sword

You set it up as:
DTM
<Colour here>
DTM
<01>Sword

By using <01> it takes the colour of whatever it is above it. So instead of having 3 strings for each sword colour you only have one string.

Lastly you can change locations and comments to preexisting strings and use a notepad file to tell yourself that String X = Hyper Triggers, etc,

OK that's all I know.




Jan 22 2013, 4:46 pm Azrael Post #4



Quote from Roy
If SCMDraft is the only editor you use, all you need to do is give the strings the same name, and SCMDraft will recycle the string for you. A common tactic regarding trigger comments is to have a comment-trigger (a trigger that just holds a Comment action in it) that describes what a group of triggers is about (e.g., "Location Grid Scanning"), and all related triggers below it have a comment that's just a single space in it.

Or don't use comments at all. Especially with the ability to add notes to the text triggers, it's a really unnecessary and inefficient practice.




Jan 23 2013, 12:19 am Leeroy_Jenkins Post #5



Yeah I don't use comments anyways. If I delete a 'display text message' trigger action, does SCMDraft automatically delete the string?



None.

Jan 23 2013, 1:32 am NudeRaider Post #6

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Usually yes, but sometimes ScmDraft loses track of the references to the string references and the string just sits in the string list and occupies a slot. This appears to be a rare bug, possibly connected to map corruption due to string recycling.

If it happens, you can just delete the string manually via the string menu.




Jan 23 2013, 7:05 am Oh_Man Post #7

Find Me On Discord (Brood War UMS Community & Staredit Network)

Quote from Azrael
Or don't use comments at all. Especially with the ability to add notes to the text triggers, it's a really unnecessary and inefficient practice.
Hmm what how do you do this?




Jan 23 2013, 9:32 am Lanthanide Post #8



He just means adding comments into the text triggers. Which does work, but I use the classic trigedit as the primary point for editing triggers; I only use text triggers when I need to do tedious stuff or big editing sessions where I need to copy and paste a lot.



None.

Jan 23 2013, 11:06 am Oh_Man Post #9

Find Me On Discord (Brood War UMS Community & Staredit Network)

Text triggers? Hmm? What are those?




Jan 23 2013, 2:05 pm Roy Post #10

An artist's depiction of an Extended Unit Death

SCMDraft has a text trigger editor, which can compile triggers based on a syntax much like a programming language. Any commented-out notes you add to it are not saved in the editor, though. I think Azrael means maintaining your triggers in an external program like Notepad++ and copy/pasting into the text trigger editor.




Jan 23 2013, 5:02 pm Oh_Man Post #11

Find Me On Discord (Brood War UMS Community & Staredit Network)

Yer so there's no way to do that using the regular triggers hey. Because I use both.




Jan 24 2013, 8:31 am O)FaRTy1billion[MM] Post #12

👻 👾 👽 💪

Adding to this ...
Quote from Roy
If SCMDraft is the only editor you use, all you need to do is give the strings the same name, and SCMDraft will recycle the string for you. A common tactic regarding trigger comments is to have a comment-trigger (a trigger that just holds a Comment action in it) that describes what a group of triggers is about (e.g., "Location Grid Scanning"), and all related triggers below it have a comment that's just a single space in it.
Don't even use a space. By just putting an empty string it wont count towards any string but still just show as an empty bar. If you put a space then that will still use 1 string.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Jan 24 2013, 8:12 pm Kaias Post #13



Quote from Lanthanide
He just means adding comments into the text triggers. Which does work, but I use the classic trigedit as the primary point for editing triggers; I only use text triggers when I need to do tedious stuff or big editing sessions where I need to copy and paste a lot.
This was my biggest request for Scmdraft- for pseudo comments that weren't stored in the map itself and the ability to organize triggers in a tree structure.

But I don't use classic trigedit anymore.



None.

Jan 24 2013, 8:40 pm Wormer Post #14



It was much better if SCMD saved text triggers in a separate file (with predefined name) in the mpq archive along with the map. Then classic trigedit should have read that text file for triggers instead of reading them directly from the map data (of course if the triggers text file wasn't found then it should have read triggers from map data). Like I said in another thread, a good design idea is to base triggers on a specific language and work all GUI stuff from there.



Some.

Jan 24 2013, 8:53 pm CecilSunkure Post #15



Quote from Kaias
Quote from Lanthanide
He just means adding comments into the text triggers. Which does work, but I use the classic trigedit as the primary point for editing triggers; I only use text triggers when I need to do tedious stuff or big editing sessions where I need to copy and paste a lot.
This was my biggest request for Scmdraft- for pseudo comments that weren't stored in the map itself and the ability to organize triggers in a tree structure.

But I don't use classic trigedit anymore.
This sort of thing should be really easy to do for an editor :(



None.

Jan 28 2013, 2:32 am Heinermann Post #16

SDE, BWAPI owner, hacker.

There is actually a method that isn't used in any editors (I don't even think tinymap2 uses it) for "recycling" strings.

I'm going to go ahead and call it substring recycling.

EXAMPLE:
You have two different coloured texts:

"<red>Welcome"
"<grey>Welcome"

well they can be combined to form
"<grey><red>Welcome"

You will have two string references, one that points to "<grey><red>Welcome" and the other points to its substring "<red>Welcome".


There are probably much better applications than this.




Jan 28 2013, 5:18 am rockz Post #17

ᴄʜᴇᴇsᴇ ɪᴛ!

Essentially string 1 points to <grey> and is 9 bytes, and string 2 points to <red> and is 8 bytes, right?

Edit: yep

Quote
"STR " section

Note: Required for Melee game type This section contains all the strings in the map. Note: This section can contain more then 1024 strings and will work in Starcraft

2 byte integer: Number of strings in the section
(# of strings) 2 byte integers: 1 integer for each string specifying the offset (the spot where the string starts in the section from the start of it).
Strings: After the offsets, this is where every string in the map goes, one after another. Each one is terminated by a null character.

Quote
Every trigger has 16 of the following format, even if only one condition is used. See the appendix for information on which items are used for what conditions.

4 byte long: Location number for the condition (1 based)
4 byte long: Group (0 based) that the condition applies to
4 byte long: Qualified number (how many/resource amount)
2 byte integer: Unit ID condition applies to
1 byte: Comparison type/switch state
1 byte: Condition byte (see the appendix)
1 byte: Resource type/score type/switch number
1 byte: Flags
Bit 0 - Unknown/unused
Bit 1 - Enabled flag. If on, the trigger action/condition is disabled/ignored
Bit 2 - Always display flag.
Bit 3 - Unit properties is used. Unnecessary (Note: This is uses in *.trg files).
Bit 4 - Unit type is used. May not be necessary?
Bit 5 - If on, the unit ID is used. Unnecessary.
Bit 6-7 - Unknown/unused
2 bytes: Used internally by starcraft (number of which condition to process next, and maybe more?)

Immediately following the 16 conditions, there are 64 actions. There will always be 64 of the following structure, even if some of them are unused.

4 byte long: 'Source' or only location (#1 based)
4 byte long: String number for trigger text
4 byte long: String number of. WAV file
4 byte long: Seconds/milliseconds of time
4 byte long: First, or only group/player affected.
4 byte long: Second group affected, destination location (1-based), CUWP #, number, AI script, switch
2 byte integer: Unit/score/resource type/alliance status
1 byte: Action byte. See appendix.
1 byte: Number of units/switch action/unit order/modify type. 0 specifies all units.
1 byte: Flags
Bit 0 - Unknown/unused
Bit 1 - Enabled flag. If on, the trigger action/condition is disabled
Bit 2 - Always display flag.
Bit 3 - Unit properties is used. Staredit uses this for *.trg files.
Bit 4 - Unit type is used
Bit 5 - If on, the unit ID is used. Unnecessary.
Bit 6-7 - Unknown/unused
3 bytes: Used internally by starcraft (number of which action to process next, and maybe more?)

Following the 16 conditions and 64 actions, every trigger also has this structure

4 bytes: Used internally by starcraft (unknown usage. may be used to check if the trigger is "finished", ie no preserve trigger and the trigger has already run)
28 bytes: 1 byte for each player in the players/groups list (except for the last one) (see appendix).
00 - Trigger is not executed for player
01 - Trigger is executed for player
There's a large number of unknown/unused bits in triggers which could easily be used by an editor in order to make custom trigger actions/conditions. This would be useful for EUDs with the Memory condition, so that it doesn't mess up when you use deaths of terran marine.

Post has been edited 2 time(s), last time on Jan 28 2013, 5:30 am by rockz.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jan 28 2013, 5:30 am Lanthanide Post #18



That style of string recycling is rather limited to strings that are exact prefixes, where the right-most section of the string is identical and there are only two parts to the string. If you've got strings like "You have 5 seconds left" and "You have 4 seconds left", that method can't save any space, despite only a single character being different.



None.

Jan 28 2013, 5:38 am rockz Post #19

ᴄʜᴇᴇsᴇ ɪᴛ!

If you forego punctuation, you can save a lot of space that way by referring to unit names at the end of sentences in strings.

"Don't die Gandalf"

it's a lot of work that would likely only save you a few hundred bytes.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jan 28 2013, 7:22 am O)FaRTy1billion[MM] Post #20

👻 👾 👽 💪

Quote from rockz
There's a large number of unknown/unused bits in triggers which could easily be used by an editor in order to make custom trigger actions/conditions. This would be useful for EUDs with the Memory condition, so that it doesn't mess up when you use deaths of terran marine.
For flags, maybe. But the "unknown/unused" fields are for alignment and not part of the structs. I tried using them in TrigPlug, but SC does not copy them.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are some real members mixed in those latter pages, but the *vast* majority are spam accounts
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are almost 3k pages
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- the real members stop around page 250
[2024-4-14. : 9:20 pm]
O)FaRTy1billion[MM] -- look at the members list
[2024-4-12. : 12:52 pm]
Oh_Man -- da real donwano
da real donwano shouted: This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
it's pretty common
[2024-4-11. : 9:53 pm]
da real donwano -- This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
[2024-4-11. : 4:18 pm]
IlyaSnopchenko -- still better than "Pakistani hookers in Sharjah" that I've seen advertised in another forum
[2024-4-11. : 4:07 pm]
Ultraviolet -- These guys are hella persistent
[2024-4-11. : 3:29 pm]
Vrael -- You know, the outdoors is overrated. Got any indoor gym and fitness equipment?
[2024-4-10. : 8:11 am]
Sylph-Of-Space -- Hello!
Please log in to shout.


Members Online: MetalGear, otorusvgjq, Oh_Man