• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] (Player group((Player(TriggeringPlayer)))) Solved: It leaks

Status
Not open for further replies.
  • Inventory Slot Tooltip
    • Events
    • Conditions
    • Actions
      • For each (Integer GenericLoopCount) from 1 to MaxAllSlotTypes, do (Actions)
        • Loop - Actions
          • Set SlotOfPlayer = ((TriggeringPlayer x MaxAllSlotTypes) + GenericLoopCount)
          • Set RandomLocation[1] = (Mouse Position for Triggered Mouse Event)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (BackpackRegion[GenericLoopCount] contains RandomLocation[1]) Equal to True
            • Then - Actions
              • Custom script: call RemoveLocation(udg_RandomLocation[1])
              • Special Effect - Play Special Effect: xxxTheTestEffect, Animation: Stand
              • Set RandomLocation[1] = (Center of BackpackRegion[GenericLoopCount])
              • Special Effect - Set Position of xxxTheTestEffect to x: (X of RandomLocation[1]), y: (Y of RandomLocation[1]), z: 11.00
              • Custom script: call RemoveLocation(udg_RandomLocation[1])
              • If (LocalPlayerN Equal to TriggeringPlayer) then do (Floating Text - Change text of TooltipText to (InvItemName[SlotOfPlayer] + (|n + InvObjDescriptor[SlotOfPlayer])) using font size 7.00) else do (Do nothing)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Hero[TriggeringPlayer] has buff Merchant Buff ) Equal to True
                  • InvItemValue[SlotOfPlayer] Not equal to 0
                • Then - Actions
                  • -------- THIS AREA STILL NEEDS LOCAL PLAYER --------
                  • Floating Text - Change text of TooltipValue to ((|c00E1E100 + (String((Integer(((Real((Max(InvItemValue[SlotOfPlayer], (InvItemValue[SlotOfPlayer] x InvItemQuantity[SlotOfPlayer]))))) x PlayerSellRatio[TriggeringPlayer])))))) + g|r) using font size 7.00
                • Else - Actions
                  • Floating Text - Change text of TooltipValue to using font size 7.00
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • InvItemQuantity[SlotOfPlayer] Less than or equal to 0
                • Then - Actions
                  • If (LocalPlayerN Equal to TriggeringPlayer) then do (Floating Text - Change text of TooltipText to (InvItemName[SlotOfPlayer] + (|n + InvObjDescriptor[SlotOfPlayer])) using font size 7.00) else do (Do nothing)
                • Else - Actions
                  • If (LocalPlayerN Equal to TriggeringPlayer) then do (Floating Text - Change text of TooltipText to (InvItemName[SlotOfPlayer] + (( ( + ((String(InvItemQuantity[SlotOfPlayer])) + )|n)) + InvObjDescriptor[SlotOfPlayer])) using font size 7.00) else do (Do nothing)
              • Floating Text - Show TooltipText for (Player group((Player(TriggeringPlayer))))
              • Floating Text - Show TooltipValue for (Player group((Player(TriggeringPlayer))))
              • Set GenericLoopCount = MaxAllSlotTypes
            • Else - Actions
              • Custom script: call RemoveLocation(udg_RandomLocation[1])
              • Special Effect - Play Special Effect: xxxTheTestEffect, Animation: Death
              • Floating Text - Hide TooltipText for (Player group((Player(TriggeringPlayer))))
              • Floating Text - Hide TooltipValue for (Player group((Player(TriggeringPlayer))))
So this is obviously kind of a chunky trigger. But if someone could please help me understand where it leaks I would love you. This trigger, while not on very frequently will run for every mouse movement of the player. It is imperative this one is leak free.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,206
Doesn't (Player group((Player(TriggeringPlayer)))) create a new force everytime?
Ops... I did not notice that. Stupid unreadable GUI...

Solution is to cache the player groups in a player group array. One can then use the player slot index as an index in the array to get the player group. This recycles the same player groups and hence no leak.
 
Status
Not open for further replies.
Top