hell_knight
Playing WoW
- Reaction score
- 126
String Manipulation Tutorial
By hell_knight99
By hell_knight99
Starting Off
String Maniupulation is very simple as soon as you understand how to work it. After you get started its straight forward and simple. With practice you can easily perfect the skill of String Manipulation. Some notes.
- Pay attention that spaces do count in string length
- Ex, -level 99 is 9 letters long.
- You must know how to count.
- All entered chat strings must be sub string.
The Basics
Time to start off with the basics. First you need an idea of something you want to do, whether it be a command giving gold, changing level, or changing a players name. I will give a trigger which you can examine and study. Then i will explain how it works.
Level up
Events
Player - Player 1 (Red) types a chat message containing -level as A substring
Conditions
(Length of (Entered chat string)) Equal to 9 Hmm -level and a space is only 7 letters long why is this set to 9?
Actions
Hero - Set Blood Mage 0000 <gen> Hero-level to (Integer((Substring((Entered chat string), 8, 9)))), Hide level-up graphics What is this giberish?
_________________________________________________________________
Hero - Set Blood Mage 0000 <gen> Hero-level to (Integer((Substring((Entered chat string), 8, 9)))), Hide level-up graphics is what I think the most vital part of this trigger. First of all I go to Hero set level-blood mage , then his hero level is to go to? Press Convert String to Interger, Substring, Entered Chat String. Now W.E knows your talking about that string.
Second it needs to know what part of it to convert, for the first number is where it starts converting, so lets put letter 8, which happens to be the first number, then 9 meaning the second number. It is then converted to a number.
-level 10 will give you a level 10 hero, but -level 1 wont! But -level 01 works. Why??
This trigger is very basic and thats one of its flaw is can be fixed which is more advanced and will be discussed later. But the alternate way is to type -level 0 then the one digit number.
Practice with this. If you are more advanced read on.
_________________________________________________________________
Name Changing
Ahh who doesn't love this one. It allows you to change a players name.
Now I will teach you how to do this one.Like the last I will show you the trigger then explain it to you.
Name Change
Events
Player - Player 1 (Red) types a chat message containing -name as A substring
Conditions No Condition Needed
Actions
Player - Set name of (Triggering player) to (Substring((Entered chat string), 7, (Length of (Entered chat string)))) Almost the same thing
_________________________________________________________________
Almost the same thing heh? Player - Set name of (Triggering player) to (Substring((Entered chat string), 7, (Length of (Entered chat string)))) So we make the message we want. We still need to count though. Player- Set Name- to Substring >> Entered Chat String >> The length of your chat string+ the space + 1 , Then for the second number go to String Length, Entered Chat String. So it sets the players name from letter 7 to the end of the chat string. Not too hard ehh>?
_________________________________________________________________
The Finals
Wow it seemed so short don't you think. Once you understand string manipulation is very simple. Now to put your skills to one final test. Remember the basics? Now to teach how to change it so that the first one works like -level 1 or like -level 10. Just like the last 2 trigger, examination,study, explantion,practice.
Level up Copy
Events
Player - Player 1 (Red) types a chat message containing -level as A substring
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (Entered chat string)) Equal to 9
Then - Actions
Hero - Set Blood Mage 0000 <gen> Hero-level to (Integer((Substring((Entered chat string), 8, 9)))), Hide level-up graphics
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Length of (Entered chat string)) Equal to 8
Then - Actions
Hero - Set Blood Mage 0000 <gen> Hero-level to (Integer((Substring((Entered chat string), 8, 8)))), Hide level-up graphics
Else - Actions
Do nothing
_________________________________________________________________
Theres no difference if you brake it up. First of all there is no longer a condition. So we put a If/All/Cond True, if its equal to 9 string length then repeat exactly what you did in the basics. NOW the different part is copy and paste now. Change (Length of (Entered chat string)) Equal to 9 to (Length of (Entered chat string)) Equal to 8 then change the hero set levle bloodmage substring,blahblah to 8,8 instead of 8,9. Disable your first The Basics trigger. Now test it if you did it right it should work.
Finishing Credits
This is my first Tutorial Ever.Please take it easy on me I am considering screenshots but string manipulation doesn't really show anything but success which teaches nothing.
Please Give Reputation if you found this useful