Tutorial String Manipulation Tutorial

hell_knight

Playing WoW
Reaction score
126
String Manipulation Tutorial
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.
  1. Pay attention that spaces do count in string length
  2. Ex, -level 99 is 9 letters long.
  3. You must know how to count.
  4. 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
 
Well it seem 3.5 stars it could use pictures
but
could you tell me how when a person types in a chat message like so

Code:
         [COLOR="DeepSkyBlue"]Event[/COLOR]
         [COLOR="Red"]Player[/COLOR] - Player 1 (Red) types a chat message containing [COLOR="Lime"]-name ruler[/COLOR] as An exact match

could you make it so there name become what they type
so it would now it will be ruler :shades:
can you help me
 
Code:
Untitled Trigger 001
    Events
        Player - Player 1 (Red) types a chat message containing <Empty String> as An exact match
    Conditions
    Actions
        Player - Set name of Player 1 (Red) to (Entered chat string)
*Comments*
Your using the worng event :( The substring event would mean that i could type: "123-level". So the event triggers and condition triggers, even though the string is wrong. You should use this instead:
Code:
Untitled Trigger 001
    Events
        Player - Player 1 (Red) types a chat message containing <Empty String> as An exact match
    Conditions
        (Entered chat string) Equal to whatever
    Actions
Using the stringlength as condition is simply not good enough.
 
Please Give Reputation if you found this useful
Add code tags to GUI actions. Creating a Rep Farm is just lame... people will keep you in mind if they find it really useful.
 
I agree with Sooda. For me it seems like you didn't even investigate other options, even though they might be better (they are!). You just used the one you knew! A reminder for further tutorials:
When you make a tutorial you should have proper knowlegde on the subject to teach others the entire subject, even though your tutorial only covers some part of the subject.
Please Give Reputation if you found this useful
Nobody should find this usefull...
 
PHP:
[code][/code]

CODE tags.


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

Too big.
This thread seems only to attract rep for you if you see what we've said. It shouldn't be there.


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

Can be done in 1 line of action and 1 line of of condition.


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

7,20. 14 max letters.


1. Pay attention that spaces do count in string length
2. Ex, -level 99 is 9 letters long.
3. You must know how to count.
4. All entered chat strings must be sub string.

Nope.


Just to let know : if no Conditions, what happens when we write : blabla -name ?

^^ ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    They are pretty similar, but this one is much less involved than a real CNC. A lot less moving parts
    +1
  • The Helper The Helper:
    Happy Monday!
  • The Helper The Helper:
    Added a new Cocktail recipe even though I quit drinking - not about me though :) Nordic Gibson - https://www.thehelper.net/threads/cocktail-nordic-gibson.196598/
  • Varine Varine:
    +1
  • Varine Varine:
    I've been really into this
  • Varine Varine:
    It's a musical retelling of The Odyssey
  • Varine Varine:
    Also if you want mixed drinks without alcohol, there's a handful of non-alcoholic 'spirits'. Ritual Zero and Free Spirit are the two brands I've tried and they are alright. They don't have a TON of options, but they have some gin and whiskey alternatives that are fun to play with.
  • Varine Varine:
    I got a couple bottles to make some mixy drinks around holidays when I mostly want to drink, they aren't exact replacements but they are surprisingly close.
  • Varine Varine:
    I ended up with some hop water things that I really like instead for when I want to feel like I'm participating
  • Varine Varine:
    I just got moved to unsupervised probation, so I can get away with drinking a bit now. I technically am not supposed to, but I don't think I get checked anymore. I really want to smoke weed but it scares me
  • The Helper The Helper:
    Happy Wednesday! I am not feeling it today, my teeth are bothering me, or the fragments that were left behind are coming up and it is extra painful today. Don't ever let them tell you that getting full dental implants is easy. They have to pull all your teeth to do those and apparently they are not very good at getting all the teeth out all the time.
    +1
  • The Helper The Helper:
    That is true with Dentures too. I am taking the day off and working from home. The big difference is though, I am not drinking anymore so I have a nice tea and coffee regimen set up :)
  • Varine Varine:
    I wish i had a 3D scanner
  • Varine Varine:
    That would make what I'm doing SO much easier
  • Varine Varine:
    I guess I could just take a picture of it and then use that as a reference. I have a circuit board with some weird holes I can't get measured right
  • Varine Varine:
    Oh I got a Klipper mod for my big printer! It comes with a bunch of parts and I don't totally understand what it does but apparently it's way better than Marlin, which is I think what it currently runs
    +1
  • The Helper The Helper:
    Nice!
  • Varine Varine:
    You're people in Florida safe? The only couple I know are safe but I think they evacuated.
  • The Helper The Helper:
    They are without power but safe. Flood damage and stuff alot of tornados hit east Florida. No fatalities or injuries to any of my people that I know of
  • The Helper The Helper:
    They have been through all the Florida hurricanes they are like me I have been through every texas hurricane for the last 50 years.
  • The Helper The Helper:
    Never evacuated.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top