• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Trigger] Chat command, need some help

Status
Not open for further replies.
Level 4
Joined
Jul 28, 2008
Messages
93
Hey, i'm trying to make a chat command to rename a player by saying "name xxxx" But i'm not sure how to make it so it only reads the second part of the command (the xxxx part).

Nvm, i think i figured this out.
 
Last edited:
Level 16
Joined
Mar 3, 2006
Messages
1,564
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing A as A substring
      • Player - Player 1 (Red) types a chat message containing B as A substring
      • Player - Player 1 (Red) types a chat message containing C as A substring
      • Player - Player 1 (Red) types a chat message containing D as A substring
      • Player - Player 1 (Red) types a chat message containing E as A substring
      • Player - Player 1 (Red) types a chat message containing F as A substring
      • -------- repeat all this events with the remaining alphabets or numbers (if you need numbers in the name) --------
      • Player - Player 1 (Red) types a chat message containing Z as A substring
    • Conditions
    • Actions
      • Player - Set name of Player 1 (Red) to (Entered chat string)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Starquizer, you fail,
Element of Water, you win!
Only you should have given him the right function instead of some rip-off written function,,
  • Player - Set name of (Triggering Player) to (Substring((Length of "name "), Length of (Entered Chat string)))
There you go,,
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Element of Water is right...
This is the trigger (created in a rush :p)

  • rename
    • Events
      • Player - Player 1 (Red) types a chat message containing -name as A substring
      • Player - Player 2 (Blue) types a chat message containing -name as A substring
      • Player - Player 3 (Teal) types a chat message containing -name as A substring
      • Player - Player 4 (Purple) types a chat message containing -name as A substring
    • Conditions
    • Actions
      • Player - Set name of (Triggering player) to (Substring((Entered chat string), 7, (Length of (Entered chat string))))
If you want to set a max. value (recommended when using multiboards!), just change the "Length of Entered Chat String".
I believe the Warcraft max. is 14-15. (so it would be 7, 21).
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
yeah, but what if i want a name that uses spaces? That is possible, and what if i want to be named "-Yixx,,-" in-game? Or "Lil' Wayne - 15-10-09 =D" (lol i gotta admit, that didnt just pop up in my head xD) that will not be possible.. Thus using Element of Water's way is much better and much easier,,
Also, you trigger does not set my name to LOL if i type:
L
O
L
It will set my name to L..
lol forget it, i thought you said exact string, not substring,,
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Starquizer,, Substring = part of a string,, Blizzard example sucks, but ill explain:
Substring("Grunt", 2,4) = run, because: Grunt
Substring(String,x,y) takes the xth letter, and the yth letter and everything in between and makes a string out of it.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
The problem with what you said is that I don't understand this line:

set name of triggering player to substring (string length of "name ", string length of entered chat string)

What is this substring (string length of "name ", string length of entered chat string) I never seen anything like this in the WE where can I find it ?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
"Substring" is right below "Concatenate Strings" and above "Ability Name".
It's a very, awesomely useful action.

Examples:
  • You can create all your commands into 1 trigger (yes: all of them... every command in the entire map can be made into 1 single trigger, talking about efficiency...).
  • You can use this for every command that includes player-chosen numbers (e.g.: "-give 1 100", gives red 100 gold - this is also done with substrings)
  • This is case-sensitive, so you can check case-sensitive strings with this :O
 
Status
Not open for further replies.
Top