Queries

General discussion of Warcraft 3. Threads may may be posted here if they don't fit into the other sections.

Moderator: Cheaters

Apple
Forum Staff
Posts: 1470
Joined: November 3rd, 2010, 10:48 am
Title: Best Player
Location: Singapore
Contact:

Queries

Post by Apple »

I need help on what the substrings are? And What are the integers behind the substrings.
Request a map? Follow the rulesHERE
Request templateHERE
Please, do not PM me.
On the side note, I'm still playing vampirism speed on malaysia room, occasionally in Garena. Bcuz too lazy to find out where else I can play them.
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Queries

Post by naturesfury »

it takes a string, and returns a part of that string
syntax: SubString(string,start,end)
string=what string you want a part of
start=what place to start at
end=what place to end at
ex:
local string dummyvar=""
local string whee="THIS is a STRING!"
set dummyvar=SubString(whee,5,8)

now dummyvar is "is "
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Queries

Post by naturesfury »

it takes a string, and returns a part of that string
syntax: SubString(string,start,end)
string=what string you want a part of
start=what place to start at
end=what place to end at
ex:
local string dummyvar=""
local string whee="THIS is a STRING!"
set dummyvar=SubString(whee,5,8)

now dummyvar is "is "
Apple
Forum Staff
Posts: 1470
Joined: November 3rd, 2010, 10:48 am
Title: Best Player
Location: Singapore
Contact:

Re: Queries

Post by Apple »

What is the 5,8?
is it <space>is<space>?


God.Is.A.Dog wrote:Oh understand. 5th and 8th alphabet.
Request a map? Follow the rulesHERE
Request templateHERE
Please, do not PM me.
On the side note, I'm still playing vampirism speed on malaysia room, occasionally in Garena. Bcuz too lazy to find out where else I can play them.
Slickslime
Forum Staff
Posts: 543
Joined: October 7th, 2008, 5:41 am

Re: Queries

Post by Slickslime »

Please do not double post.
Apple
Forum Staff
Posts: 1470
Joined: November 3rd, 2010, 10:48 am
Title: Best Player
Location: Singapore
Contact:

Re: Queries

Post by Apple »

Did I ?
Request a map? Follow the rulesHERE
Request templateHERE
Please, do not PM me.
On the side note, I'm still playing vampirism speed on malaysia room, occasionally in Garena. Bcuz too lazy to find out where else I can play them.
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Queries

Post by naturesfury »

Woah....dont even no how that happened =/...musta double clicked or something....
oppsie :D (idk how to delete either so.....meh)

in the example, dummyvar is "is<space>"
Apple
Forum Staff
Posts: 1470
Joined: November 3rd, 2010, 10:48 am
Title: Best Player
Location: Singapore
Contact:

Re: Queries

Post by Apple »

I thought 5 is a <space>
why it starts with "i"
Request a map? Follow the rulesHERE
Request templateHERE
Please, do not PM me.
On the side note, I'm still playing vampirism speed on malaysia room, occasionally in Garena. Bcuz too lazy to find out where else I can play them.
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Queries

Post by naturesfury »

count stating with 0
User avatar
Risugami
Senior Member
Posts: 134
Joined: September 25th, 2011, 1:15 pm
Title: Slacking

Re: Queries

Post by Risugami »

Uses of Strings :
In my opinion, the use of strings is by far the most interesting and clever and most interactive way to let players manipulate and use the game. Anything, '-ar' and '-apen' to '-name' are all examples of using strings. Even when you type a simple message to a friend, you are using strings to communicate and send a message. Strings could be used for more advanced things, like tax and such. In games like SotDRP, a popular battle.net role playing game, the entire game is operated through commands like 'size ###' and 'tint ###' to mod the units in the game.

Uses of Substrings :
Let's face it. Without substrings, I don't think any String Related systems and snippets would be possible. Substrings allow us to look at specific things in the string, instead of the whole thing. When using '-name', we use substrings to only look at what comes after the '-name' instead of setting the players name to '-name Jimmy'. In '-apem' we make sure that the string begins with '-apem' instead of the host saying "No -Apem'. Without substrings, the host could accidently trigger a mode, or someone would have a stupid name. I mean, who wants to be named '-name Jimmy'?

How to use Substrings
Substrings may seem confusing at first. For a long time, I did not know how to use Substrings, and I was afraid to ask for help. Being such a big helper, I did not want to look stupid. SELF REVELATION FOR THE WIN. But, anyway, after a bit, I learned to use them from testing and learning. Now, look, this is how substrings work.
Image
In this example, 'Substring (2,5)' is 'RUNT'. How do I find this? Look at the small (red) numbers before each letter or symbol. That is the letter's substring integer, a phrase I will use in this tutorial. Now, the substring's integers are the '2,5' in the string. '2' is the starting point, and '5' is the last letter in the integer. This goes for anything. To see if you understand it, answer this question. When you think you know what it is, click the spoiler.

Q: What is 'Substring 4,6' in 'Thanksgiving Turkey'?
Spoiler:
A: 'nks'


Substrings in JASS
If you want to find Substrings in JASS, they are almost the same. The thing is, in JASS, the first character is 0. See, the thing is, in GUI, it is made to be easy for people to understand without learning a language. So, 1 seams like a better place to start than 0. But, in JASS, there is no reason to make it really easy, so it starts at 0. So, just find the regular string numbers, and subtract one. So, SubString(2,6) in GUI is SubString(1,5) in JASS.

Code: Select all

 G R U N T ' S
0 1 2 3 4 5 6 7
Image Image
(Made by: Risugami) | Risugami's Signature Workshop

"As a young boy, I was taught in high school that hacking was cool. - Kevin Mitnick"
Post Reply