Jump to content

What's a LABEL tag?


Recommended Posts

To be honest, I only know what the weidu readme says:

Quote

Defines the LABEL, or unique textual identifier, of this module. Any component can have zero or more LABELs. Will print a warning if two components in the same tp2 share a LABEL. Do not alter a component’s LABEL once you publish that mod.

So, it's kind of a check name other mods (or the same mod?) can use to detect installed components of other mods.

How to actually use it I'd be interested as well.

Link to comment

Example of detecting component install with LABEL:

ACTION_IF (MOD_IS_INSTALLED "grammarsalad_mod.tp2" (ID_OF_LABEL "grammarsalad_mod/grammarsalad_mod" "test1")) BEGIN
    PRINT "grammarsalad_mod installed: component test1"
END ELSE BEGIN
    PRINT "grammarsalad_mod not installed: component test1"
END

 

Link to comment
5 minutes ago, Gwendolyne said:

Example of detecting component install with LABEL:


ACTION_IF (MOD_IS_INSTALLED "grammarsalad_mod.tp2" (ID_OF_LABEL "grammarsalad_mod/grammarsalad_mod" "test1")) BEGIN
    PRINT "grammarsalad_mod installed: component test1"
END ELSE BEGIN
    PRINT "grammarsalad_mod not installed: component test1"
END

 

What's the benefit of that vs just MOD_IS_INSTALLED <designated number>  Or is it one way vs the other way and neither is especially better than the other?

EDIT: Never mind, I can see the benefit of a label over a number since component order can change.

EDIT 2:   Ok fine.  Adding labels to my tp2 file now.  Thank you @Gwendolyne!

Edited by Lauriel
Link to comment

It might work since it sounds like it would generate a warning...but not an error.  I have several subcomponents.  I can give it a test run.

EDIT: Who am I kidding.  I don't have time for this....but I will eventually test it...someday.

Edited by Lauriel
Link to comment
20 minutes ago, subtledoctor said:

I’m pretty sure a component can have a functionally unlimited number of LABELs. Might be misremembering though. 

Yeah, but the docs say you can't have multiple components share the same label.  That's what we're wondering about.

Link to comment

Ok, I tested this.  Labeling multiple options of the same subcomponent with the same label will make it so that any checks using that label will return false, unfortunately.  That would have been handy in case of subcomponents.  Oh well.

Link to comment

Argh, of course giving several subcomponents the same LABEL would't work and give an error because it's, well, the same label for several components. That kind of explains the error it produces...

Ok, nothing to see here, folks. Please, move on...

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...