| 08-12-2006, 04:15 PM | #1 |
MrApple's Guide to Playing with Player Names V2.1 -7/17/06 Introduction In this tutorial you will learn how to check for certain player names, change player names, color player names, and a whole bunch of other player name stuff. Also you will learn how to get around capitalization, take care of spoofers, and lock triggers so only you may use them in-game! ---1 – Coloring Names--- So, what’s a ‘Player Name’? The Player Name is the Name of the Player, the account name. Such as my account name on these forums is MrApples. Ever wonder how people color text in their maps? They use a thing called Color Codes. What are Color Codes? Color Codes are a way of telling the game what color to use in text. The look like this; |c00FF0303|r 00FF0303 is the Actual Code. |c is the start. |r is the end. (TIP: The "|" sign is the "Shift" form of "\", it's right above the "Enter" key ) The Text you want to color goes in between and Code, and the End. |c00FF0303TextGoesHere|r Some Basic Color Codes |c00FF0303TEXT|r = Red |c000042FFTEXT|r = Blue |c001CE6B9TEXT|r = Teal |c00540081TEXT|r = Purple |c00FFFC01TEXT|r = Yellow |c00FEBA0ETEXT|r = Orange |c0020C000TEXT|r = Green |c00E55BB0TEXT|r = Pink |c00959697TEXT|r = Gray |c007EBFF1TEXT|r = Light Blue |c00106246TEXT|r = Dark Green |c004E2A04TEXT|r = Brown (TIP: Need a specific color? You can generate any color you want with this tool.) Ok, I get the Color Codes part, but how am I supposed to color the names? Ok here is where it gets tricky, you may be thinking “How do you expect me to check what the Player’s Color is for every player just to put out a simple message”, and well I don’t expect you to do that. You have to use something called an Array Variable, don’t know what that is? Then you must [http://www.wc3campaigns.net/showthread.php?t=81210]read this before continuing.[/url] Using the Array Variable for your bidding Now you must add the following actions to your Initialization Trigger. (TIP: All triggers seen in this tutorial are available in a map attached below. But I recommend beginners to try to find all the actions yourself first. ) Trigger: Initilization![]() Conditions![]() Actions![]() ![]() -------- ADD THESE ACTIONS TO YOUR INITILIZATION TRIGGER --------![]() ![]() -------- What you need for this Trigger. --------![]() ![]() -------- //A Array String Variable Named Color --------![]() ![]() -------- //A Array String Variable Named PlayerName --------![]() ![]() -------- //A Array String Variable Named OriginalName --------![]() ![]() -------- //A Array String Variable Named BlockedName --------![]() ![]() Set BlockedName[1] = EnterNameHere![]() ![]() Set BlockedName[2] = EnterNameHere![]() ![]() -------- You will use BlockedName later on in the tutorial. --------![]() ![]() Set Color[1] = |c00FF0303![]() ![]() Set Color[1] = |c00FF0303![]() ![]() Set Color[2] = |c000042FF![]() ![]() Set Color[3] = |c001CE6B9![]() ![]() Set Color[4] = |c00540081![]() ![]() Set Color[5] = |c00FFFC01![]() ![]() Set Color[6] = |c00FEBA0E![]() ![]() Set Color[7] = |c0020C000![]() ![]() Set Color[8] = |c00E55BB0![]() ![]() Set Color[9] = |c00959697![]() ![]() Set Color[10] = |c007EBFF1![]() ![]() Set Color[11] = |c00106246![]() ![]() Set Color[12] = |c004E2A04![]() ![]() -------- These Color Codes are just good to keep on a variable. --------![]() ![]() -------- Now you can color text alot easier. --------![]() ![]() Player Group - Pick every player in (All players) and do (Actions)![]() ![]() ![]() Loop - Actions![]() ![]() ![]() ![]() Set OriginalName[(Player number of (Picked player))] = (Name of TempPlayer)![]() ![]() ![]() ![]() -------- Player Number is a Integer. For Player 1 (Red), it would be 1, for Player 2 (Blue), it would be 2, etc. --------![]() ![]() ![]() ![]() -------- OriginalName is also for later on in the tutorial. --------![]() ![]() ![]() ![]() -------- This checks looks for the player with the certain color... --------![]() ![]() ![]() ![]() -------- and then adds the correct color code to the string variable which holds their name. --------![]() ![]() ![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)Voila! Now it’s all set up, but you’re wondering how to actually use it? Well it’s easy! Trigger: UsingTheColoredName![]() Events![]() Conditions![]() Actions![]() ![]() -------- All you have to do is use the PlayerName variable [The Number of the Player you want the name for] --------![]() ![]() -------- Say I wanted to display that "Player 1 Red (in Color) is a peanut head!", I would do this... --------![]() ![]() Game - Display to (All players) the text: (PlayerName[1] + is a peanut head!)![]() ![]() -------- Note: I used Concentrate Strings, put the variable in the first slow, and " is a peanut head!" in the second. --------![]() ![]() -------- --------![]() ![]() -------- Now, what if you want to display that "(Triggering Player) is a smelly goose!" in one of your triggers? --------![]() ![]() -------- You would do this! --------![]() ![]() Game - Display to (All players) the text: (PlayerName[(Player number of (Triggering player))] + is a smelly goose!)![]() ![]() -------- Do you get it now? I hope so. If not make sure to reply to the thread and tell me what you don't get. --------Now you know how to use colorful Player Names in-game, awesome! But let’s not stop here, there’s a lot more fun to be had when you’re Playing with Player Names! ---2 – Changing Player Names--- Say wha? Changing Player Names?!? Yes you can change Player Names in-game, it’s actually very easy, you just use the Action “Player – Set Name”. But however, changing the player’s name to what the player wants, and keeping it colored, is a little trickier. Also, its only in-game, once they leave the game their name will be reset. (TIP: This part of the tutorial requires you have a basic understanding of Chat Event Triggers, read my tutorial here!) Great! So you know how to use Chat Event Triggers! Well I am going to show you a trigger where when a player types –name, everything after –name(including a space), will be set to a variable(as long as its not longer then 20 characters), and then the players name will be changed to that variable. Trigger: Rename Simple![]() 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![]() Actions![]() ![]() -------- Note: Theres a space after -name. --------![]() ![]() -------- You will need for this trigger... --------![]() ![]() -------- //A String Variable named NewName --------![]() ![]() -------- --------![]() ![]() -------- This is a simple rename trigger. --------![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() ![]() Player - Set name of (Triggering player) to NewName![]() ![]() -------- But what if you wanted to make it so players couldn't frame other players? --------![]() ![]() -------- Or frame you even, the creator of your map? --------![]() ![]() -------- What if you wanted to know who someones Original Name was before they changed it? --------![]() ![]() -------- Well this is all going to be explained, yay! --------So what if you want to make a trigger that checks if it’s ok for the player to have that name. By ok I mean that it does not conflict with another player’s current name, original name, or any name on the BlockedName list I told you to make before. OriginalName keeps track of the players original name, incase anyone wants to check who they are, and so no one gets mixed up. BlockedName is a list of 12 names that you want no one to change their name to in-game, like your name, so no one can frame you. But what happens if you join the game and your name is blocked? Well we can fix that too! Trigger: 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![]() Actions![]() ![]() -------- Note: Theres a space after -name. --------![]() ![]() -------- You will need for this trigger... --------![]() ![]() -------- //A String Variable named NewName --------![]() ![]() -------- //A Boolean Variable named NameVio (Stands for NameViolation) --------![]() ![]() -------- --------![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() -------- This simply checks if the NewName is actually the players original name. --------![]() ![]() ![]() ![]() Player - Set name of (Triggering player) to NewName![]() ![]() ![]() ![]() Set PlayerName[(Player number of (Triggering player))] = ((Substring(PlayerName[(Player number of (Triggering player))], 1, 10)) + (NewName + |r))![]() ![]() ![]() ![]() Skip remaining actions![]() ![]() ![]() ![]() -------- If so, then it skips the rest, theres no point in continuing. --------![]() ![]() ![]() Else - Actions![]() ![]() For each (Integer A) from 1 to 12, do (Actions)![]() ![]() ![]() Loop - Actions![]() ![]() ![]() ![]() -------- For each integer is a loop action that goes through once for each number --------![]() ![]() ![]() ![]() -------- (Integer A) = The number of the current loop. --------![]() ![]() ![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() ![]() ![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() ![]() ![]() -------- If - Or Any Condtions are True is on the bottom of the action menu. --------![]() ![]() ![]() ![]() ![]() ![]() -------- If you have more then 12 BlockedNames, you will have to edit this to check all of them. --------![]() ![]() ![]() ![]() ![]() ![]() -------- If it detects that the requested NewName is equal to any of the following... --------![]() ![]() ![]() ![]() ![]() ![]() -------- --The Current name of a player. --------![]() ![]() ![]() ![]() ![]() ![]() -------- --The Original Name of a player. --------![]() ![]() ![]() ![]() ![]() ![]() -------- --A Name on your Blocked Names list --------![]() ![]() ![]() ![]() ![]() ![]() Set NameVio = True![]() ![]() ![]() ![]() ![]() ![]() -------- It will set NameVio = True, which means the players name isn't going to be changed... --------![]() ![]() ![]() ![]() ![]() ![]() -------- To what he/she wants anyway :). --------![]() ![]() ![]() ![]() ![]() Else - Actions![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() -------- NameVio = False, no collision! The game will allow them to have that new name. --------![]() ![]() ![]() ![]() Player - Set name of (Triggering player) to NewName![]() ![]() ![]() ![]() Set PlayerName[(Player number of (Triggering player))] = ((Substring(PlayerName[(Player number of (Triggering player))], 1, 10)) + (NewName + |r))![]() ![]() ![]() ![]() -------- The Substring 1,10 is the Color Code. --------![]() ![]() ![]() ![]() -------- This Sets PlayerName = (The First 10 Characters of PlayerName(The Color Code)) + NewName + (|r) --------![]() ![]() ![]() Else - Actions![]() ![]() ![]() ![]() Set NewName = Stupid Idiot![]() ![]() ![]() ![]() -------- Aha!, a collision was detected, then now their new name will be Stupid Idiot. --------![]() ![]() ![]() ![]() -------- That'll teach them for trying to mess with people. --------![]() ![]() ![]() ![]() Player - Set name of (Triggering player) to NewName![]() ![]() ![]() ![]() Set PlayerName[(Player number of (Triggering player))] = ((Substring(PlayerName[(Player number of (Triggering player))], 1, 10)) + (NewName + |r))Congratulations, you just learned how to make your very own Rename trigger! And a very good one at that. Unmasking the Bandit So in-game it’s great, everyone is amazed by your Player-Name abilities, but what if you come across someone who’s acting really nasty and their hiding behind their new name so you can’t act nasty back. Don’t you wish you could check what their real username is? Well I made this nice trigger here just for that! Trigger: NameCheck![]() Events![]() ![]() Player - Player 1 (Red) types a chat message containing -namecheck as A substring![]() ![]() Player - Player 2 (Blue) types a chat message containing -namecheck as A substring![]() Actions![]() ![]() -------- Note: Theres a space after -namecheck. --------![]() ![]() -------- You will need for this trigger... --------![]() ![]() -------- //A String Variable named TempString --------![]() ![]() Set TempString = (Substring((Entered chat string), 12, (Length of (Entered chat string))))![]() ![]() 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)![]() ![]() ![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() ![]() ![]() -------- This goes through every Player Name seeing if any of them are equal to TempString --------![]() ![]() ![]() ![]() ![]() ![]() -------- If it does then it displays to the person who typed the -namecheck the... --------![]() ![]() ![]() ![]() ![]() ![]() -------- ...Original Name of the player who owns the matching player name. --------![]() ![]() ![]() ![]() ![]() ![]() Game - Display to (All players) for 30.00 seconds the text: (PlayerName[(Integer A)] + ( real Username is + OriginalName[(Integer A)]))![]() ![]() ![]() ![]() ![]() Else - ActionsNow you can get nasty right back at that nasty guy. ---3 – Capitalization--- Dear MrApples, your triggers suck! The rename trigger doesn’t stop framing at all, and the name check never works! Wow, I’m such a bad person. Actually the triggers do work, but Capitalization is not supported. If a BlockedName is MrApples, and someone does –name Mrapples (Notice the a), then the game will accept it. But don’t worry; there is a way to fix even this! And it’s actually really easy. Just follow the few instructions in the following 2 triggers. Trigger: Rename Cap![]() Events![]() Conditions![]() Actions![]() ![]() -------- All you must do to fix the Rename Trigger so i works with capitalization is to edit all of the String Comparisons --------![]() ![]() -------- So that now they are Conversion - Convert String as Lowercase(WhatItWasBefore) --------![]() ![]() -------- Then it will check all the strings as if they were lowercase, but not change them. --------![]() ![]() -------- --------![]() ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() ![]() ![]() If - Conditions![]() ![]() ![]() ![]() (String(NewName) as Lower case) Equal to (String(OriginalName[(Player number of (Triggering player))]) as Lower case)![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() -------- It was done in the above condition --------![]() ![]() ![]() ![]() Player - Set name of (Triggering player) to NewName![]() ![]() ![]() ![]() Set PlayerName[(Player number of (Triggering player))] = ((Substring(PlayerName[(Player number of (Triggering player))], 1, 10)) + (NewName + |r))![]() ![]() ![]() ![]() Skip remaining actions![]() ![]() ![]() Else - 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)Trigger: NameCheck Cap![]() Events![]() ![]() Player - Player 1 (Red) types a chat message containing -namecheck as A substring![]() ![]() Player - Player 2 (Blue) types a chat message containing -namecheck as A substring![]() Actions![]() ![]() -------- And you must do the same thing for name check. --------![]() ![]() Set TempString = (Substring((Entered chat string), 12, (Length of (Entered chat string))))![]() ![]() 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![]() ![]() ![]() ![]() ![]() ![]() (String((Name of (Player((Integer A))))) as Lower case) Equal to (String(TempString) as Lower case)![]() ![]() ![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() ![]() ![]() -------- As done in the above String Comparison. --------![]() ![]() ![]() ![]() ![]() ![]() Game - Display to (All players) for 30.00 seconds the text: (PlayerName[(Integer A)] + ( real Username is + OriginalName[(Integer A)]))![]() ![]() ![]() ![]() ![]() Else - ActionsCongratulations, you’re done with the Capitalization Section! ---4- Security--- Locking your Triggers Say you have some test triggers, or ‘cheats’ in-game you only want certain people using, well it can be done! All you have to do is add a condition to the Chat Event Trigger like Case ((Player Name of (Triggering Player))) as lower case = NameOfYourself. Trigger: Voila! The trigger will only work when someone with your name types the event. But you may notice that those naughty framers can go on to even a higher level with this. (TIP: You can reverse this method to get back at people you don’t like. Say Bobwhostoleyourcereal plays your map, you can check if anyone’s name is Bobwhostoleyourcereal, and then change it to something like BADCEREALSTEALER. That’ll teach him.) Stopping Spoofers Here are 2 problems with using user-name locked triggers. 1. Usernames are not cross-server; someone can register your name on another server and use the trigger. 2. Spoofers. Spoofs make it so the game detects the hacker’s name as something else, such as yours. It’s easy to fix 1, register your username on all the servers, if its taken, keep trying every month, or your out of luck. For 2, it’s not so easy. There is no way to detect a difference between a spoofer’s username and yours. But however, you are 2 different people nevertheless, so you have to use something you know that the hacker doesn’t, like a password! You will have to make 2 triggers to do this, 1 trigger that accepts the password, and another trigger that after 5 minutes has passed, detects if anyone has your username, and if they have entered a password or not. (TIP: Make sure everyone who is supposed to use the password types it in Observers, so other players can’t see. If you want to be extra safe, change the triggering players name to a really long space until the message has faded so its hidden. Trigger: Password![]() Events![]() ![]() Player - Player 1 (Red) types a chat message containing applesnacks as An exact match![]() ![]() Player - Player 2 (Blue) types a chat message containing applesnacks as An exact match![]() Conditions![]() Actions![]() ![]() -------- You will need for this trigger --------![]() ![]() -------- //A Array Boolean Variable called Clear --------![]() ![]() Set Clear[(Player number of (Triggering player))] = True![]() ![]() -------- Thats it for this trigger, all done. But if you want to be extra safe add the below --------![]() ![]() -------- Remember this is very buggy. --------![]() ![]() Player - Set name of (Triggering player) to ...![]() ![]() Wait 45.00 game-time seconds![]() ![]() Player - Set name of (Triggering player) to (Substring(PlayerName[(Player number of (Triggering player))], 11, ((Length of PlayerName[(Player number of (Triggering player))]) - 2)))![]() ![]() -------- I can't fit all of the above action, but this is what it does --------![]() ![]() -------- Set Name of (Triggering Player) = PlayerName variable - Color Code and |r --------![]() ![]() -------- It only takes the stuff between the Color Code and |r --------Trigger: Check Names![]() Conditions![]() Actions![]() ![]() -------- 300 seconds is 5 minutes for the slow ones. --------![]() ![]() 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)![]() ![]() ![]() ![]() ![]() Then - Actions![]() ![]() ![]() ![]() ![]() ![]() -------- It checks if a players name is equal to any of the names they shouldn't have. --------![]() ![]() ![]() ![]() ![]() ![]() -------- And then it checks if that player has been cleared by typing in the password. --------![]() ![]() ![]() ![]() ![]() ![]() -------- If he hasn't, then these actions are played. --------![]() ![]() ![]() ![]() ![]() ![]() Set OriginalName[(Integer A)] = SpoofingBadGuy![]() ![]() ![]() ![]() ![]() ![]() Set PlayerName[(Integer A)] = ((Substring(PlayerName[(Integer A)], 1, 10)) + (SpoofingBadGuy + |r))![]() ![]() ![]() ![]() ![]() ![]() Player - Set name of (Player((Integer A))) to SpoofingBadGuy![]() ![]() ![]() ![]() ![]() ![]() -------- This changes the OriginalName, CurrentName, and the Colored CurrentName to SpoofingBadGuy --------![]() ![]() ![]() ![]() ![]() ![]() -------- You can of course here punish that player here. Boot him, take his gold, whatever you want. --------Please comment on how this tutorial can be improved, if you find anything that you find confusing, or may be confusing to others, please post it. Notice: This tutorial is written in a more experimental style then my previous ones so it is essential you tell me if you understood everything or not! I remind you that if you find a tutorial or post that were helpful to you to give the Author good rep. |
| 08-12-2006, 04:25 PM | #2 |
what? you used images instead of trigger tags? |
| 08-12-2006, 04:27 PM | #3 |
Yeah I did, this is originally for TheHelper. You think DarkOrange goes good with this background? Also did you know that Edit > Find doesn't work well with 'Advanced' post editing, it locks up half the time. |
| 08-12-2006, 05:43 PM | #4 | |
Quote:
|
| 08-12-2006, 06:03 PM | #5 |
Trust me, if you seen my past coloring schemes this is 'avoiding them'. Also if it didn't have color I myself would have trouble reading it... ADD. And the combined images for this are like 8megebytes, i'msure theres a upload limit? Besides the file type isn't accepted. |
| 08-12-2006, 09:31 PM | #6 |
You need to use trigger tags, not images. |
| 08-12-2006, 11:18 PM | #7 |
Trigger tags Advantages, IMO -CnP -Low filesize to store -Easy to implement -Open and Close (+ & -) -Icons (help for people to find which trigger is in which place) -Alot of others things It makes me cry that every other forum dosent have them, they are a great idea. |
| 08-14-2006, 06:26 AM | #8 |
Thank you for adding the [trigger] tags. Mike or someone please review this. |
| 08-15-2006, 08:31 AM | #9 |
Yeah, I think this covers everything there is about player names. Very entertaining too. I have one suggestion: Where you show the basic color codes like |c00FF0303TEXT|r = Red you could show the TEXT inside the color that it is, like: |c00FF0303TEXT|r = Red I took the freedom to change the orange text to a different font instead of orange and approve this. |
| 08-15-2006, 06:04 PM | #10 |
Don't like it now, but w/e, I won't update this. |
| 08-16-2006, 06:21 AM | #11 |
Great tutorial, very creative and fun thing to impliment. Props |
| 08-17-2006, 02:01 PM | #12 |
You do not need to create an global array to colour the text properly. Just use this: JASS:function GetStringColored takes player id, string r returns string local playercolor col=GetPlayerColor(id) if col == PLAYER_COLOR_RED then set r="|cffff0000"+r+"|r" elseif col == PLAYER_COLOR_BLUE then set r="|cff0000ff"+r+"|r" elseif col == PLAYER_COLOR_CYAN then set r="|cff93ffc9"+r+"|r" elseif col == PLAYER_COLOR_PURPLE then set r="|cff400080"+r+"|r" elseif col == PLAYER_COLOR_YELLOW then set r="|cffffff00"+r+"|r" elseif col == PLAYER_COLOR_ORANGE then set r="|cffff8000"+r+"|r" elseif col == PLAYER_COLOR_GREEN then set r="|cff00c400"+r+"|r" elseif col == PLAYER_COLOR_PINK then set r="|cffff80c0"+r+"|r" elseif col == PLAYER_COLOR_LIGHT_GRAY then set r="|cff808080"+r+"|r" elseif col == PLAYER_COLOR_LIGHT_BLUE then set r="|cffCCDDFF"+r+"|r" elseif col == PLAYER_COLOR_AQUA then set r="|cff004000"+r+"|r" elseif col == PLAYER_COLOR_BROWN then set r="|cff663300"+r+"|r" else set r="|cff000000"+r+"|r" endif set col=null return r endfunction function GetPlayerNameColored takes player id returns string return GetStringColored(id,GetPlayerName(id)) endfunction |
| 08-30-2006, 07:46 PM | #13 | |
Quote:
|
| 09-09-2006, 01:50 AM | #14 |
No it's not possible, your wrong. There are ways to detect a FEW spoofers but it is impossible to be certain of it. |
| 09-03-2007, 01:55 AM | #15 |
Great tutorial i'll be sure to use some of these in my map. ![]() |
