• 🏆 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!

SubStrings and Strings and whatnot

Status
Not open for further replies.
Level 2
Joined
Mar 31, 2005
Messages
23
I'm a little confused on how to work this, so if someone could explain it to me, it would be really helpful. I figured out how to get "-setname" working as a substring, but I can't figure out how to do anything with following String, can anyone help me with this?

Sorry if I didn't explain this so well. :?
 
Level 6
Joined
Sep 17, 2005
Messages
276
greenbaron said:
but I can't figure out how to do anything with following String, can anyone help me with this?

what do you mean with that? please specify your problem a bit. only saying tell me about strings is a bit rare... what is 'anything'? :?
 
Level 2
Joined
Mar 31, 2005
Messages
23
I want to do things like "-setname 01 (player number) MYNAMEHERE" and have it change the player name to "MYNAMEHERE." That a good enough explanation?
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Actually you didn't explain very well, but I guess your trying to make a setname system like in DoBRP.

Requirements (you must have this first):

-Two variables of type String. Name it OneName1 and Name02 (for example). Enable Array and set it to 8.

This should do it:

Events:

Player - Player 1(Red) types a chat message containing setname as A substring
Player - Player 2(Blue) types a chat message containing setname as A substring
Player - Player 3(Teal) types a chat message containing setname as A substring
(Do this for all players)

Conditions:

String Comparison: (Substring((Entered chat string), 1, 8 )) Equal to setname>

Actions:

Set Variable: Set Name02[(Player number of (Triggering player))] = ((OneName1[(Player number of (Triggering player))] + (Substring((Entered chat string), 9, 119))) + |r)


I hope you can find all the stuff when making Actions. Good Luck.:wink:

-Rui
 
Level 6
Joined
Sep 17, 2005
Messages
276
greenbaron said:
I want to do things like "-setname 01 (player number) MYNAMEHERE" and have it change the player name to "MYNAMEHERE." That a good enough explanation?

well then you quest is answered by rui :D
 
Level 2
Joined
Mar 31, 2005
Messages
23
Well, I sort of made the trigger, though I'd appreciate it if you'd explain what the two numbers after subtring are supposed to do.
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
I don't know how to explain that very well but I guess this explenation does it: the 1-8 detects the number of letters you write.

s-e-t-n-a-m-e->
1-2-3-4-5-6-7-8

subtring 1 - 8

This means that only the setname isn't stored.

The ones at the end,

9,119

The number 9, is to prevent the trigger to store the setname>, otherwise when you typed for example -hi, the name (for example) John: Hi wouldn't appear. It would show up like this setname>John: Hi.
For the number 119, I belive that it's the limit of letters you can write when playing in-game.

Substrings are easy to understand if you master them.

-Rui
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Your welcome, I figured out how to make most things of DoBRP myself. In fact, I kind of guessed what that Substrings meant by myself, but just thinking like this. If the 8 first letters is setname>, then a subtring might work on this :p. It's a long story =P

-Rui
 
Level 6
Joined
Sep 17, 2005
Messages
276
Rui said:
The ones at the end,

9,119

The number 9, is to prevent the trigger to store the setname>, otherwise when you typed for example -hi, the name (for example) John: Hi wouldn't appear. It would show up like this setname>John: Hi.
For the number 119, I belive that it's the limit of letters you can write when playing in-game.

correct, but instead of 119 you can use string length of (entered chat string). so you get the exact word without " " space.
 
Status
Not open for further replies.
Top