• 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.

Resource trading.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
I need to create a trigger that can send X amount of gold to a specific player.

Example: you type " -gold red 190"

190 gold is sent to player red.

I don't know how to have separate input-able fields. Can anyone help me out how to do this?
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
do "-gold [player number] [amount]"

You'd need an event like
  • Player - Player 1 (Red) types a chat message containing -gold as An exact match
In the trigger conditions you'll have nothing.

Pass it through a loop with all players searching for the correct player number.
You are looking for string comparison and substring on one side and what it needs to match on the other(player number).

When it gets to the correct player take the rest of teh string (substring again) and transfer the gold.[/trigger]
 
Level 12
Joined
Dec 2, 2016
Messages
733
  • Send gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -g as A substring
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Current gold to (Integer((Substring((Entered chat string), 2, 10))))
This is what I came up with but I can't figure out how to take the full amount of the string and set the amount as that value. Like I want to take all of the value from 2 - 10 as above^ and set it as that inputted value.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
An example

  • player l trading gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -gg as A substring
      • Player - Player 2 (Blue) types a chat message containing -gg as A substring
      • Player - Player 3 (Teal) types a chat message containing -gg as A substring
      • Player - Player 4 (Purple) types a chat message containing -gg as A substring
      • Player - Player 5 (Yellow) types a chat message containing -gg as A substring
      • Player - Player 6 (Orange) types a chat message containing -gg as A substring
      • Player - Player 7 (Green) types a chat message containing -gg as A substring
      • Player - Player 8 (Pink) types a chat message containing -gg as A substring
      • Player - Player 9 (Gray) types a chat message containing -gg as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -gg as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -gg as A substring
      • Player - Player 12 (Brown) types a chat message containing -gg as A substring
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (Player((Integer A)))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • red Equal to (Substring((Entered chat string), 5, 7))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 1 (Red) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 1 (Red) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 9, 15)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 9, 15))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 1 (Red) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[0]) + (String_playernames[0] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 1 (Red) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[0]) + (String_playernames[0] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • blue Equal to (Substring((Entered chat string), 5, 8))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 2 (Blue) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 2 (Blue) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 10, 16)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 10, 16))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 2 (Blue) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[1]) + (String_playernames[1] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[1]) + (String_playernames[1] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                          • Player - Add Integer_Gift to Player 2 (Blue) Current gold
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • teal Equal to (Substring((Entered chat string), 5, 8))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 3 (Teal) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 3 (Teal) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 10, 16)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 10, 16))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 3 (Teal) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[2]) + (String_playernames[2] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 3 (Teal) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[2]) + (String_playernames[2] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • purple Equal to (Substring((Entered chat string), 5, 10))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 4 (Purple) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 4 (Purple) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 12, 18)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 12, 18))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 4 (Purple) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[3]) + (String_playernames[3] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 4 (Purple) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[3]) + (String_playernames[3] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • yellow Equal to (Substring((Entered chat string), 5, 10))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 5 (Yellow) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 5 (Yellow) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 12, 18)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 12, 18))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 5 (Yellow) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[4]) + (String_playernames[4] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 5 (Yellow) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[4]) + (String_playernames[4] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • orange Equal to (Substring((Entered chat string), 5, 10))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 6 (Orange) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 6 (Orange) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 12, 18)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 12, 18))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 6 (Orange) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[5]) + (String_playernames[5] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 6 (Orange) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[5]) + (String_playernames[5] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • green Equal to (Substring((Entered chat string), 5, 9))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 7 (Green) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 7 (Green) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 11, 17)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 11, 17))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 7 (Green) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[6]) + (String_playernames[6] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 7 (Green) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[6]) + (String_playernames[6] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • pink Equal to (Substring((Entered chat string), 5, 8))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 8 (Pink) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 8 (Pink) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 10, 16)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 10, 16))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 8 (Pink) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[7]) + (String_playernames[7] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 8 (Pink) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[7]) + (String_playernames[7] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • grey Equal to (Substring((Entered chat string), 5, 8))
                      • gray Equal to (Substring((Entered chat string), 5, 8))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 9 (Gray) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 9 (Gray) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 10, 16)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 10, 16))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 9 (Gray) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[8]) + (String_playernames[8] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 9 (Gray) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[8]) + (String_playernames[8] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • lb Equal to (Substring((Entered chat string), 5, 6))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 10 (Light Blue) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 10 (Light Blue) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 8, 14)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 8, 14))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 10 (Light Blue) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[9]) + (String_playernames[9] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 10 (Light Blue) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[9]) + (String_playernames[9] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • dg Equal to (Substring((Entered chat string), 5, 6))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 11 (Dark Green) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 11 (Dark Green) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 8, 14)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 8, 14))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 11 (Dark Green) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[10]) + (String_playernames[10] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 11 (Dark Green) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[10]) + (String_playernames[10] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • brown Equal to (Substring((Entered chat string), 5, 9))
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • ((Player((Integer A))) is in PlayerGroup_Vamps) Equal to True
                          • (Player 12 (Brown) is in PlayerGroup_Vamps) Equal to True
                      • And - All (Conditions) are true
                        • Conditions
                          • (Player 12 (Brown) is in PlayerGroup_Humans) Equal to True
                          • ((Player((Integer A))) is in PlayerGroup_Humans) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 11, 17)))) Less than or equal to ((Player((Integer A))) Current gold)
                    • Then - Actions
                      • Set Integer_Gift = (Integer((Substring((Entered chat string), 11, 17))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 12 (Brown) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[11]) + (String_playernames[11] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                    • Else - Actions
                      • Set Integer_Gift = ((Player((Integer A))) Current gold)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer_Gift Greater than 0
                        • Then - Actions
                          • Player - Set (Player((Integer A))) Current gold to (((Player((Integer A))) Current gold) - Integer_Gift)
                          • Player - Add Integer_Gift to Player 12 (Brown) Current gold
                          • Game - Display to (All players) for 1.00 seconds the text: ((String_PlrColor[((Integer A) - 1)] + String_playernames[((Integer A) - 1)]) + ((|r has given + String_PlrColor[11]) + (String_playernames[11] + (|r [|cffffff00 + ((String(Integer_Gift)) + |r] gold!)))))
                        • Else - Actions
                • Else - Actions
            • Else - Actions
To be completely honest, it is a bit painful to look at this trigger... 1/5 just for sheer effort.

@Rugarus If you decide to go with colours. Save them in a made-up enum like this:
  • Event
    • Map initialization
  • Actions
    • Set Colour[0] = "Red"
    • Set Colour[1] = "Blue"
    • Set Colour[2] = "Teal"
    • ...
    • Set Colour[11] = "Brown"
You can evaluate which colour it is by the first few characters like this:

-gg red //first four chacacters are 'r' 'e' 'd' & ' '
-gg yellow 'y' 'e' 'l' 'l'
-gg purple 'p' 'u' 'r' 'p'

Have another enum containing where the gold amount should start off from.

You can pretty much do it in a single loop with about 2-4 If-statements.
Make it as automatic as possible and keep it as compact as you can.
Don't repeat the same actions if you can avoid it.
 
Level 12
Joined
Dec 2, 2016
Messages
733
  • Send gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -g as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Matched chat string), 3, 5)) Equal to red
        • Then - Actions
          • Set Amount = (Integer((Substring((Entered chat string), 7, 10))))
          • Player - Set Player 1 (Red) Current gold to Amount
        • Else - Actions
I got it to work if it just has the value between the entered substring. But how do I detect if a string has a certain word, like

f = "hello world"

How do I check the entire string for "ello"

I want to have one if statement that checks if "red" is found in the chat message then send gold to red.
 
Level 13
Joined
May 10, 2009
Messages
868
You'll have to use an empty string variable + loops and the SubString function. Analyse each letter using a loop + SubString, and add the result to that variable (concatenate strings).
Example:

For LoopA from 4 to 13 (I'm already taking "-g " into consideration, that's why it starts at 4)
tmp_string = tmp_string + SubString(Entered Chat String, LoopA, LoopA)​

Afterwards, you check if a valid color/word has been formed. As soon as you find such word, break out of the loop with exitwhen true.

Edit: GUI SubString is a bit different; I had to adapt the example above.
 
Last edited:
Status
Not open for further replies.
Top