Author Topic: Evaluation of the REQUIRE_COMPONENT modComponent number  (Read 4360 times)

Offline AL|EN

  • Planewalker
  • *****
  • Posts: 328
  • Gender: Male
Evaluation of the REQUIRE_COMPONENT modComponent number
« on: August 30, 2019, 02:56:55 AM »
Hi,

Wouldn't it be too much trouble to extend functionality of REQUIRE_COMPONENT in order to allow evaluation of the modComponent number, just as MOD_IS_INSTALLED action?

This example currently fails:

Quote
BACKUP "IEModA\backup"
SUPPORT "IEModA"
VERSION "1.1.0"


BEGIN "MainComponent" LABEL "IEModA-MainComponent" DESIGNATED 1000


    OUTER_SET ID = ID_OF_LABEL "IEModA.tp2" "IEModA-MainComponent"
    PRINT "%ID%"


BEGIN "ExtraComponent" LABEL "IEModA-ExtraComponent" DESIGNATED 2000
REQUIRE_COMPONENT "IEModA.tp2" (ID_OF_LABEL "IEModA.tp2" "IEModA-MainComponent") "Require IEModA-MainComponent"


    OUTER_SET ID = ID_OF_LABEL "IEModA.tp2" "IEModA-ExtraComponent"    PRINT "%ID%"


This is workaround but with the drawbacks:

Quote
BEGIN "MainComponent" LABEL "IEModA-MainComponent" DESIGNATED 1000


    OUTER_SET ID = ID_OF_LABEL "IEModA.tp2" "IEModA-MainComponent"
    PRINT "%ID%"


BEGIN "ExtraComponent" LABEL "IEModA-ExtraComponent" DESIGNATED 2000
    ACTION_IF MOD_IS_INSTALLED "IEModA.tp2" (ID_OF_LABEL "IEModA.tp2" "IEModA-MainComponent") BEGIN
    OUTER_SET ID = ID_OF_LABEL "IEModA.tp2" "IEModA-ExtraComponent"
    PRINT "%ID%"
    END ELSE BEGIN
        ABORT "Require IEModA-MainComponent"
    END

« Last Edit: August 30, 2019, 03:06:04 AM by AL|EN »
You cannot have progress without committing changes...A Basic Modder's Guide to Git and Github

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1071
Re: Evaluation of the REQUIRE_COMPONENT modComponent number
« Reply #1 on: August 30, 2019, 02:12:46 PM »
Can you use REQUIRE_PREDICATE? Allowing REQUIRE_COMPONENT to evaluate stuff essentially turns it into a slightly different REQUIRE_PREDICATE.

Offline AL|EN

  • Planewalker
  • *****
  • Posts: 328
  • Gender: Male
Re: Evaluation of the REQUIRE_COMPONENT modComponent number
« Reply #2 on: August 31, 2019, 01:57:45 AM »
I can:

Quote
BACKUP "IEModA\backup"
SUPPORT "IEModA"
VERSION "1.1.0"

BEGIN "MainComponent" LABEL "IEModA-MainComponent" DESIGNATED 1000
    OUTER_SET IEModA-MainComponent = ID_OF_LABEL "IEModA" "IEModA-MainComponent"
    PRINT "%IEModA-MainComponent%"

BEGIN "ExtraComponent" LABEL "IEModA-ExtraComponent" DESIGNATED 2000
    REQUIRE_PREDICATE (MOD_IS_INSTALLED "IEModA.tp2" (ID_OF_LABEL "IEModA" "IEModA-MainComponent" )) "Require IEModA-MainComponent"
    OUTER_SET IEModA-ExtraComponent = ID_OF_LABEL "IEModA" "IEModA-ExtraComponent"
    PRINT "%IEModA-ExtraComponent%"

I guess you can't do anything in terms of simplifying the syntax. One thing I notice that 'MOD_IS_INSTALLED' needs '.tp2', does it have to?


You cannot have progress without committing changes...A Basic Modder's Guide to Git and Github

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: