• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] How to set amounth of chat??

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Use "Substring".

Player x enters 'message' as a (exact Match or SubString).

If you use "exact match" the trigger actions will happen when the player types EXACTLY something.

If you use "Substring" you can play with the entered chat string, for that, we use the "substring" action.

Lets say you want to receive gold with "-gold xxxx" command.

You use "Player X enters -gold a a substring"

when the player enters anything containing "-gold" in it, the actions will come. Now, we want to give the amount of gold typed in the message, now "substring" comes into action. What "Substring" does is take a part of the entered chat string and so something with it. We want to use the numbers after the "-gold" and transform that into effective gold to that player.

Substring works with characters intervals, this means, you can take characters from X to Y. If you type "-gold" you're using 5 characters, but then, you add a space, which would make the message as "6", being "-gold " (with the blank space) The rest of the characters would be the amount, that can use 1, 2, 3, 4, 5 or any amount of numbers, if you want to enable a certain amount of digits to the number, then you can use "Substring(7,9)" that would take the values in the entered chat string, from the 7th, to the 9th, example:

-gold 1234567

What the game reads is "-gold 12".

IF you want to enble any value, from 1, to 999999999999999999999999999*10^10, you use "Substring(7, Entered Chat String)". That will take everything from character 7 to the length of the entered chat command.

So, basically..

Event: Player X enters "-gold" as a substring
Actions: Add (Substring(7, (Entered Chat String)) to (Triggering Player) current gold.
 
Status
Not open for further replies.
Top