HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Totorail: MRP1 Chat system

10-04-2003, 06:26 PM#1
Forgoten-One (Stold in disguise)
Ever play the map mrp1 by a guy named Miyog? If you have then you will know all about the special chat system he set up in it. But you wouldn't get any details from him about how it's done. So I programmed my own version that works exactly like his! You will be requiring 2 triggers per player, per key. The first trigger will be the setting up of character names in game.
Create a new trigger, name it whatever you want but just as long as you know what it does and who it is for. Now under event you want this code (I am using my code as the example):

Player - Player 1 (Red) types a chat message containing setname- as A substring

This establishes the chat message and must be set as a substring.

Now condition:

(Substring((Entered chat string), 1, 8)) Equal to setname-

This sets up for the actual naming. Your comparing the substring chat which if you count the digits in setname-, you will have 8. So you set the substring condition with range 1 (for first digit) and 8 (for last digit). Your condition is now set.

Actions:

Set CharName_Player1 = ((|cffFF0000 + (Substring((Entered chat string), 9, 119))) + (: + |r))

This uses the set variables function. Create a variable for each player, for each key. I plan to do 5 keys for naming, the - = ! # and $ and all will use the setname function. So you have to create a new strings variable for each key. In this example I am setting the character name event to - so I made the charname_player1 strings variable to hold this. Now your going to have 2 Concatenate strings in here. First half will set the player's chosen character name in the player's color. So your using another Concatenate string for this. First part is establishing the |cffXXXXXX color, in this case the trigger is for player 1 which is red. Then the inclusion in this concatenate string which is the entered chat. We already established that the first half of the naming is 8 digits, your now going into 9+. At any given time in game your allowed 127 digets in your chat window. To find the ending amount open calculator, input 127 then minus the digits for the setname event and you got your number.

So that establishes the chosen character name event with color, now for the second half of the first concatenate event, you will again have another concatenate strings in this one. The first one will establish the : plus a space and the second half is |r which will end the coloring. The first half of your triggering is done.

New trigger now, this one is for the actual text that the player has his/her character say.

Event:

Player - Player 1 (Red) types a chat message containing - as A substring

We only need just the symbol we established the name in for this one, in this example it's the -

Condition:

(Substring((Entered chat string), 1, 1)) Equal to -

yep just like the naming event, however for the actual chat we only need 1 digit, so set the substring to 1, 1 to establish we are using only 1 digit.

Actions:

Game - Display to (All players) the text: (CharName_Player1 + (Substring((Entered chat string), 2, 126)))

We are using the game - display text message to all players. The text itself is a concatenate strings. First half is our established variable, second half is the text the character says. Since this event's command uses 1 digit we got 126 out of 127 digits available. So we start at 2 and establish the chat is allowed 126 digits max. Congratulations, you have just duplicated the very first step in creating an mrp chat system. Now repeat the steps and create duplicate variables for each player. In this example when the player types in game for example setname-John and hits enter then reopens the chat bar and types "-hey everyone check this out!" it will appear as: John: Hey everyone check this out!

Good Luck!
10-04-2003, 06:28 PM#2
Dark_MoonRider
I dont know MRP1... Wat is the special chat thing?
10-04-2003, 06:36 PM#3
Draco
Ok, that is confusing, but what about this....


<> Set Name Trigger <>

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

etc.

Actions
Player - Set name of (Triggering player) to (Substring((Entered chat string), 7, 50))

- - -

That should do what you want. Try it out. Here's the map I put it in if you wanna try it.

The syntax is "-name ?????" Up to 43 characters allowed is how I set it.
10-04-2003, 06:42 PM#4
Forgoten-One (Stold in disguise)
Thx, this totorail was setup for more expert type people
10-04-2003, 06:43 PM#5
Draco
But I thought experts always tried to make their code efficient and straight to the point.
10-04-2003, 06:48 PM#6
Forgoten-One (Stold in disguise)
Quote:
Originally posted by Draco
But I thought experts always tried to make their code efficient and straight to the point.

Hmm your rite well if they git stuck then they have a example.
10-04-2003, 07:19 PM#7
35263526
You can DL the trigger for TLoF (an RP with Miyog's triggers). That will show you.