• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Strange trigger error, no documentation?

Status
Not open for further replies.
I'm making a custom inventory system for my map and I've run into a roadblock.

When I try to update the dialog I use a script which deals with a dialog item variable.

The error I get is Trigger Error in 'gt_Debug4_Func': Could not get 'triggerControl' from parameter in 'DialogControlGetPropertyAsText' (value: 0) (This is for a debug trigger.)

Most of the code is in 4 enormous function/triggers but This is the main part of the code:

Code:
                Dialog - Create a Button for dialog (Last created dialog)
                Variable - Set Buttons[Size] = (Last created dialog item)
                Variable - Set CurrentItem = (GetItemFromInt((Integer((Custom value (loop + CUSTOM_VALUE_OFFSET) of (Triggering unit))))))
                Dialog - Set (Last created dialog item) size to (CUSTOM_ITEM_BORDER_SIZE, CUSTOM_ITEM_BORDER_SIZE) for (All players)
                Dialog - Set (Last created dialog item) Click On Down flag to True for (All players)
                Variable - Set xOffset = (DIALOG_SIZE_SIDES + (((loop mod SizeX) * (CUSTOM_ITEM_BORDER_SIZE + ITEM_BORDER_OFFSET_X)) - 1))
                Variable - Set yOffset = (DIALOG_SIZE_TOP + (((loop / SizeX) * (CUSTOM_ITEM_BORDER_SIZE + ITEM_BORDER_OFFSET_Y)) - 1))
                Dialog - Move (Last created dialog item) to (xOffset, yOffset) relative to Top Left of dialog for (All players)
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        CurrentItem == ""
                    Then
                        Dialog - Set (Last created dialog item) image to Assets\InventoryBorderEmpty.dds for (All players)
                        Dialog - Set (Last created dialog item) hover image to Assets\InventoryBorderEmpty.dds for (All players)
                    Else
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                (Get Type of Item(CurrentItem)) == Active
                            Then
                                Dialog - Set (Last created dialog item) image to Assets\InventoryBorderActive.dds for (All players)
                                Dialog - Set (Last created dialog item) hover image to Assets\InventoryBorderActiveHighlight.dds for (All players)
                            Else
                                Dialog - Set (Last created dialog item) image to Assets\InventoryBorderPassive.dds for (All players)
                                Dialog - Set (Last created dialog item) hover image to Assets\InventoryBorderPassive.dds for (All players)
                        Dialog - Set (Last created dialog item) tooltip to (Format Tooltip(CurrentItem)) for (Player group((Triggering player)))
                        * Variable - Set ItemBorders[loop][(Owner of (Triggering unit))] = (Last created dialog item)
                        * Dialog - Create a Image for dialog (Last created dialog)
                        Dialog - Set (Last created dialog item) image to (Get Item Icon(CurrentItem)) for (Player group((Triggering player)))
                        Dialog - Set (Last created dialog item) size to (CUSTOM_ITEM_SIZE, CUSTOM_ITEM_SIZE) for (All players)
                        Dialog - Move (Last created dialog item) to ((xOffset + ITEM_ICON_OFFSET_X), (yOffset + ITEM_ICON_OFFSET_Y)) relative to Top Left of dialog for (All players)
                        * Variable - Set ItemIcons[loop][(Owner of (Triggering unit))] = (Last created dialog item)


Code:
        General - For each integer loop from CUSTOM_VALUE_OFFSET to (CUSTOM_VALUE_OFFSET + Size) with increment 1, do (Actions)
            Actions
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        (Custom value loop of (Triggering unit)) < 1.0
                    Then
                        Unit - Set Unit custom value loop to (Real((GetIntFromItem(Item Type))))
                        Variable - Set val = (loop - CUSTOM_VALUE_OFFSET)
                        UI - Display (Combine ("val: ", (Text(val)), ", player:", (Text(Player)))) for (All players) to Subtitle area
                        UI - Display (Tooltip of ItemBorders[loop][Player] for Player) for (All players) to Subtitle area
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Item Type == ""
                            Then
                                Dialog - Set ItemBorders[val][Player] image to Assets\InventoryBorderEmpty.dds for (All players)
                                Dialog - Set ItemBorders[val][Player] hover image to Assets\InventoryBorderEmpty.dds for (All players)
                            Else
                                * Dialog - Set ItemBorders[val][Player] tooltip to (Format Tooltip(Item Type)) for (All players)
                                * Dialog - Set ItemIcons[val][Player] image to (Get Item Icon(Item Type)) for (All players)
                                * Dialog - Set ItemBorders[val][Player] image to Assets\InventoryBorderActive.dds for (All players)
                                * Dialog - Set ItemBorders[val][Player] hover image to Assets\InventoryBorderActiveHighlight.dds for (All players)


                    Else

The lines marked with stars are the ones causing the trouble.

This is the entire error log for the above script:

Code:
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'triggerControl' from parameter in 'DialogControlGetPropertyAsText' (value: 0)
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'text' from parameter in 'UIDisplayMessage' (value: 65535)
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'triggerControl' from parameter in 'DialogControlSetPropertyAsString' (value: 0)
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'triggerControl' from parameter in 'DialogControlSetPropertyAsString' (value: 0)
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'triggerControl' from parameter in 'DialogControlSetPropertyAsText' (value: 0)
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'triggerControl' from parameter in 'DialogControlSetPropertyAsString' (value: 0)

Even if I use a custom 'test' variable that isn't used anywhere else it will still throw this error.

The dialog is never destroyed.

Any help would be greatly appreciated.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Code:
// Control properties
const int c_triggerControlPropertyInvalid               = 0;
const int c_triggerControlPropertyText                  = 1;        // text
const int c_triggerControlPropertyStyle                 = 3;        // string
const int c_triggerControlPropertyImage                 = 4;        // string
const int c_triggerControlPropertyImageType             = 5;        // int
const int c_triggerControlPropertyColor                 = 6;        // color
const int c_triggerControlPropertyChecked               = 7;        // bool
const int c_triggerControlPropertyMinValue              = 8;        // fixed
const int c_triggerControlPropertyMaxValue              = 9;        // fixed
const int c_triggerControlPropertyValue                 = 10;       // fixed
const int c_triggerControlPropertyTooltip               = 11;       // text
const int c_triggerControlPropertyVisible               = 12;       // bool
const int c_triggerControlPropertyEnabled               = 13;       // bool
const int c_triggerControlPropertyWidth                 = 14;       // int
const int c_triggerControlPropertyHeight                = 15;       // int
const int c_triggerControlPropertyAnchor                = 16;       // int
const int c_triggerControlPropertyRelative              = 17;       // int
const int c_triggerControlPropertyRelativeAnchor        = 18;       // int
const int c_triggerControlPropertyOffsetX               = 19;       // int
const int c_triggerControlPropertyOffsetY               = 20;       // int
const int c_triggerControlPropertyEditText              = 21;       // string
const int c_triggerControlPropertyItemCount             = 22;       // int
const int c_triggerControlPropertySelectionIndex        = 23;       // int
const int c_triggerControlPropertyFile                  = 24;       // string
const int c_triggerControlPropertyOffscreen             = 25;       // bool
const int c_triggerControlPropertyChannel               = 26;       // int
const int c_triggerControlPropertyFullDialog            = 27;       // bool
const int c_triggerControlPropertyTextWriteout          = 28;       // bool
const int c_triggerControlPropertyTextWriteoutDuration  = 29;       // fixed
const int c_triggerControlPropertyBlendMode				= 30;       // int
const int c_triggerControlPropertyHoverImage            = 31;       // string
const int c_triggerControlPropertyTiled		            = 32;       // bool
const int c_triggerControlPropertyRotation              = 33;       // int
const int c_triggerControlPropertyAchievement           = 34;       // string
const int c_triggerControlPropertyRenderPriority        = 35;       // int
const int c_triggerControlPropertyClickOnDown           = 36;       // bool
You are attempting to load a property from a triggerControl (a dialog element) as an incorrect type. This logically makes no sense so it throws an error.

You have to load the above properties as the appropiate types (which the comment before the end of line provides you with) and then typecast these to the types you need for use. Galaxy does not permit implicit type casting (so trying to read a int property as a fixed will result in an error instead of the int value of the property casted to a fixed.

Likewise, when setting the properties you are required to firstly typecast to the appropiate type for that property and then use that to set the property. You can not set a int property to a fixed value as it makes no sense to the virtual machine.

Remember that the conversion from string (syncrnious) to text (asyncrnious) is one direction only. You can not use a text element to set a string property as there is no ability to typecast backwards.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Ok lets look at one of these errors more closely...
Trigger Error in 'gt_UpdateInventory_Func': Could not get 'triggerControl' from parameter in 'DialogControlGetPropertyAsText' (value: 0)

Looking at how...
const int c_triggerControlPropertyInvalid = 0;

A "triggerControl" must be their internal nickname for a dialog item. This is further backed by how a handle to one is passed as a "int control" parameter.

Thus what the error is saying is that the integer you are passing as a "triggerControl" element (the value 0) is not a valid "triggerControl" reference.

This can be looked at as a form of null pointer exception.

In your script, this means that in lines like...
Dialog - Set ItemBorders[val][Player] tooltip to (Format Tooltip(Item Type)) for (All players)
The variable ItemBorders[val][Player] you are referencing is not set to a valid triggerControl item. As you are referencing a triggerControl item which does not exist, it is generating that error when the script is evaluated.

The reason why the variable is not containing the correct value will need to be debugged. You can use the script debugger utilities that the editor provides to help you with this.

Do remember that the first human player is int 1 not int 0 (which was the first human player in WC3). Player 0 in SC2 corosponds to a neutral player.

Trigger Error in 'gt_UpdateInventory_Func': Could not get 'text' from parameter in 'UIDisplayMessage' (value: 65535)
Like wise here, you are passing a text value which does not exist to the function. This error is probably caused by the same fault as the one described above so the same fix will probably fix all errors.

Sorry for describing the wrong solution orignally. I just did not orignally see that triggerControl is SC2's script term for a dialog item.
 
Status
Not open for further replies.
Top