• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Entered Chat String

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • (String((Substring((Entered chat string), 2, 6))) as Lower case) Equal to zoom
  • (Integer((Substring((Entered chat string), 7, 10)))) Greater than or equal to 1
  • (Integer((Substring((Entered chat string), 9, 12)))) Greater than or equal to 1
As you can see the above examples, I just want to know what affects the two numbers (x , y) like 2, 6 | 7, 10 | 9, 12
What are they ?
Are they unique to a command or anything ?
Or simply, we just put it ?

Request Example:
I want a system that is based on above examples such as if I type -5, 5 footmen will appear, if I type -23, 23 footmen will appear
What command should I use ?
 
Level 11
Joined
Jul 7, 2010
Messages
709
Maybe try
  • (Integer((Substring((Entered chat string), 99, 106)))) Equal to -footmen
It means you have have up to 99 numbers e.g -45 footmen makes 45 footmen, It dsnt go higher than 99.
  • Unit - Create (Integer((Substring((Entered chat string), 1, 99)))) Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Create's the "number" you entered first e.g -34 footmen.

EDIT: I don't think this works with 1 numbers -.- like -1 footmen only works with 2.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Maybe try
  • (Integer((Substring((Entered chat string), 99, 106)))) Equal to -footmen
It means you have have up to 99 numbers e.g -45 footmen makes 45 footmen, It dsnt go higher than 99.
  • Unit - Create (Integer((Substring((Entered chat string), 1, 99)))) Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
Create's the "number" you entered first e.g -34 footmen.

EDIT: I don't think this works with 1 numbers -.- like -1 footmen only works with 2.
If 99 is the max, what is that 106 doing there ?
Hm, no. The function Substring carves out a part of the given string. The first integer represents the start position index, the other one the end.

There is an example in grey in the dialog box when selecting this function in GUI.
Yeah that, I don't get that
Grunts Stink = 2, 4, WHY ???
Try my sample map to test how substring works :D
Will test it :D

EDIT:
I know how it works, I just want to know HOW and WHY does the number differs ?
In your test map: 1, 3 | 5, 7
Why not 2, 5 | 8, 11 ???
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Substring("Grunts stink", 2, 4) = "run"

Substring got the parameters in the parentheses. The input string is "Grunts stink" and now from this string a part of it is cut out, from 2nd to 4th letter and thats the result of this function.

Code:
"Grunts stink"
 ^^^^^
 |||||
 1[COLOR=magenta]2[/COLOR]3[COLOR=magenta]4[/COLOR]5

So the result is "run" because this part lies between 2nd and 4th letter here.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If 2,4 is "run" from "gRUNt"...
What is "run" even mean for the Trigger Editor ?
Is it special function ?
Okay, like this:
If I type -100, I got 100 gold
If I type -357, I got 357 gold
What is the (x,y) of the values then ???
Is it 1,3 ???
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Substring is a univeral string opperation in almost every programming language.

It takes the start index (strings start at 0 and end at length - 1) and the break point (the index it should not add and stop adding from).

GUI being retarded offsets these so the GUI action will not behave as most substrings do. The native substring that the GUI BJ calls does behave as to be expected.
 
Level 11
Joined
May 31, 2008
Messages
698
the "run" doesnt mean anything, it is just the returned string value. so its just letters, it isnt any kind of function. To use it in a function you could do
DisplayTimedTextToPlayers(substring("GruntsStink", 2,4))
all that substring does is take a string value (grunts stink) and return a part of that string (run) which in this case is the 2nd, 3rd, and 4th letter in the original string (grunts stink)

To make the substring do something, like the -100, all you do is substringblahblah(2,4) and that will return the 100 as a string. and you could do convert string to real(substringwhatever(2,4)) to make the 100 a real value and add 100 gold, because the add gold function cant use a string value, you have to convert it.
 
Status
Not open for further replies.
Top