wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-12-2006, 04:33 PM   #1
MrApples
Banned
 
MrApples's Avatar
 
Join Date: Jul 2005
Posts: 343

Submissions (3)

MrApples is on a distinguished road (16)

Default Chat Event Triggers

MrApple's Guide to Chat Event Triggers

Introduction
This Tutorial is to teach peoples how to make things happen in game by typing a chat message.

-----Part 1 – Basic Stuff-----

Well first of all, you create a new trigger, and since there is no Generic Player Events, you must have an event for each player able to do this. Such as to give Access to All Players, and you have 12 players, it would look like this.
Trigger:
My First Chat Trigger
Collapse Events
Player - Player 1 (Red) types a chat message containing blah blah as An exact match
Player - Player 2 (Blue) types a chat message containing blah blah as An exact match
Conditions
Collapse Actions
-------- Add (Conditions) and (Actions) --------
Player - Add 1 to (Triggering player) Current gold

Now say if I wanted to make it so every time a player typed Blah Blah, they would get one gold, I would add on this action which is already in the above trigger.
Player - Add 1 to (Triggering player) Current gold
(Triggering Player) is used to respond to this Event.

-----Part 2 – Exact Match and Substrings-----


Exact Match
Exact Match means that it will only happen if the player types that message exactly. Add anything else and it will not work.

Substrings
Substrings are more fun, because if the player typed the text Anywhere in the chat message, it would happen!

Say you don’t want anyone saying "ass" in your map, cause its usually used as a naughty word. You would put this event.
Trigger:
AntiCurse
Collapse Events
Player - Player 1 (Red) types a chat message containing ass as An exact match
Player - Player 2 (Blue) types a chat message containing ass as An exact match
Conditions
Collapse Actions
Game - Display to (All players) the text: ((Name of (Triggering player)) + is a bad person!)

Ha, now you will catch those naughty people, but wait, this picks up ass anywhere in the message, so what if someone said a word that contained "ass"?

Quote:
Originally Posted by Example Conservation
Charles: So bob, how do I use the Mass Send?
Charles is a bad person!
Bob : Charles, you lied to me! I’m never speaking to you again!
Charles : I’ve gone bad! I can’t live like this!

That would be bad wouldn't it? However, there is a solution!

By adding spaces onto the ends of "ass" makes it "_ass_” and a separate word.

But unfortunately, an anti-curse system can’t be perfect cause there will always be some way around it.

-----Part 3 – Reacting Actions-----

-Parts of Substring Comparison
(Substring(Entered chat string), 7, (Length of (Entered chat string))
(Substring(The string in question), The first character # of the substring, (The last character number of the substring)

Example-
Message- I Eat Pie
(Substring(Message), 7, (Length of (Message)) = Pie
TIP: Length of Message is an integer that determines how many characters (spaces included) were in the message
The P in Pie is the 7th Character in the Message, while the e in Pie is the 9th(Total Length of Message)

--------------
Ok, say you wanted to make a trigger that would let people ally and unally through chat. You would think about it and probably come up with 12 triggers like this.
Trigger:
Long Way To Ally
Collapse Events
Player - Player 1 (Red) types a chat message containing -ally red as An exact match
Player - Player 2 (Blue) types a chat message containing -ally red as An exact match
Conditions
Collapse Actions
Player - Make (Triggering player) treat Player 1 (Red) as an Ally with shared vision

As you think to yourself, "Jeez, 12 triggers just to let people ally each-other through chat? There must be a better way!” Well there is, and there’s a few of them!

Better Way #1
Trigger:
Ally using Confusing Numbers
Collapse Events
Player - Player 1 (Red) types a chat message containing -ally as A substring
Player - Player 2 (Blue) types a chat message containing -ally as A substring
Collapse Conditions
(Substring((Entered chat string), 1, 5)) Equal to -ally
(Integer((Substring((Entered chat string), 7, 8)))) Greater than or equal to 1
(Integer((Substring((Entered chat string), 7, 8)))) Less than or equal to 12
Collapse Actions
-------- Get the above conditions by Integer Comparison, Convert String to Integer, Substring --------
Player - Make (Triggering player) treat (Player((Integer((Substring((Entered chat string), 7, 8)))))) as an Ally with shared vision
-------- Convert Player to Player Index for this action, and then the rest just like the conditions. --------
Note: Integer((Substring((Entered Chat String), 6, 6), should be Integer((Substring((Entered Chat String), 7, 8)
[/center]
What this does.
-Checks if the chat message contained -ally in it.
-Checks if the first 5 letters in the chat message = -ally
-Checks if the 6 and 7th (Length of String is an integer in this case its 7) characters of the entered chat message are within 1 and 12(The Player Numbers of possible actual people players.)
-Forces the Triggering Player to ally the Player matching the Player Number converted from the 6th and 7th characters.(1= Player 1, 2= Player 2...)


Better Way #2
You can also do it by -ally PlayerNameHere
Trigger:
Ally using Player Names
Collapse Events
Player - Player 1 (Red) types a chat message containing -ally as A substring
Player - Player 2 (Blue) types a chat message containing -ally as A substring
Collapse Conditions
(Substring((Entered chat string), 1, 5)) Equal to -ally
Collapse Actions
Set StringVariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
Set PlayerGroupVariable = (All players matching ((Name of (Matching player)) Equal to StringVariable))
Player - Make (Triggering player) treat (Random player from PlayerGroupVariable) as an Ally with shared vision
What this does
-Checks if the chat message contains -ally
-Checks if the first 5 letters in the chat message = -ally
-Creates a Player Group(Memory Leak, see a tutorial to fix this) where the only possible player in it would be the player whose name matches.
-Forces the triggering player to ally a random player from that player group, and since there is only 1, it works the same as allying that player directly.

Now you know how to do Chat Event Triggers, yay!



-----Part 4 – Extra Stuff and Given Triggers-----


I thought I would add in some cool things you can do with Chat Events!


---Boot Trigger---
Trigger:
Example Trigger Boot
Collapse Events
Player - Player 1 (Red) types a chat message containing -boot as A substring
Player - Player 2 (Blue) types a chat message containing -boot as A substring
Collapse Conditions
(Triggering player) Equal to AdminPlayer
(Substring((Entered chat string), 1, 5)) Equal to -boot
Collapse Actions
Set StringVariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
Set PlayerGroupVariable = (All players matching ((Name of (Matching player)) Equal to StringVariable))
Game - Defeat (Random player from PlayerGroupVariable) with the message: Boot!
Note: AdminPlayer is the player which you think should be able to boot.

---Continue your Education---
You can continue your education on Chat Event Triggers with my new tutorial on Playing with Player Names. Learn Renaming, fixing Capitalization in condtions, Coloring Names, and a whole bunch more!


Please comment on how this tutorial can be improved, if you find anything that you find confusing, or may be confusing to others, please post it.

I remind you that if you find a tutorial or post that is helpful to you to give the Author good rep.

Last edited by MrApples : 08-12-2006 at 04:35 PM.
MrApples is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-12-2006, 09:32 PM   #2
Tim.
Missing You All at Wc3c
 
Tim.'s Avatar


Site Owner
 
Join Date: Jul 2003
Posts: 4,475

Submissions (18)

Tim. is a name known to all (503)Tim. is a name known to all (503)Tim. is a name known to all (503)Tim. is a name known to all (503)Tim. is a name known to all (503)

Approved Map: PiratesSpell making session 3 winner

Default

Again, Trigger Tags, not images.
__________________
"oO and if anyone called Tim. trys to make an account then kick there butts." -Mavus, moderator of the GTW forums


Avast! Seen Pirates? Get it here!
Tim. is offline   Reply With Quote
Old 08-12-2006, 09:56 PM   #3
Blade.dk
.
 
Blade.dk's Avatar


Respected User
 
Join Date: May 2005
Posts: 1,990

Submissions (15)

Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)

Approved Map: Azeroth's Arcane ArenaSpell session 01 winner

Send a message via MSN to Blade.dk
Default

Using bold, italic or underlined text is a lot better than colored text - It fits better with the different themes.
__________________
Spell Making Course: Part 1: Making a simple stomp spell.
I wonder if I'll ever finish part 2.
Blade.dk is offline   Reply With Quote
Old 08-12-2006, 10:18 PM   #4
MrApples
Banned
 
MrApples's Avatar
 
Join Date: Jul 2005
Posts: 343

Submissions (3)

MrApples is on a distinguished road (16)

Default

I don't even have the triggers on file for this one, delete it if you must.
MrApples is offline   Reply With Quote
Old 08-12-2006, 10:40 PM   #5
Blade.dk
.
 
Blade.dk's Avatar


Respected User
 
Join Date: May 2005
Posts: 1,990

Submissions (15)

Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)

Approved Map: Azeroth's Arcane ArenaSpell session 01 winner

Send a message via MSN to Blade.dk
Default

Can't you just re-create them? Shouldn't take extremly long time.
__________________
Spell Making Course: Part 1: Making a simple stomp spell.
I wonder if I'll ever finish part 2.
Blade.dk is offline   Reply With Quote
Old 08-15-2006, 08:47 AM   #6
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,794

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default

Yes, these triggers shouldn't take too long to recreate and trigger tags are a requirement for it to be approved.

EDIT: Your other tutorial has been approved btw.
__________________
Zoom (requires log in)
PitzerMike is offline   Reply With Quote
Old 08-17-2006, 02:43 PM   #7
The)TideHunter(
SpeakerGames.com
 
The)TideHunter('s Avatar
 
Join Date: Mar 2006
Posts: 1,328

Submissions (1)

The)TideHunter( is a jewel in the rough (160)The)TideHunter( is a jewel in the rough (160)

Send a message via MSN to The)TideHunter(
Default

Nice tutorial. Can be helpful to some people.

I added the triggers you need to put in instead of the images to get approved, click Quote, on this post, and CnP them into your post, then i'll remove this post.
Other than that, great tut xD.

Trigger:
My First Chat Trigger
Collapse Events
Player - Player 1 (Red) types a chat message containing blah blah as An exact match
Player - Player 2 (Blue) types a chat message containing blah blah as An exact match
Conditions
Collapse Actions
-------- Add (Conditions) and (Actions) --------
Player - Add 1 to (Triggering player) Current gold

Trigger:
AntiCurse
Collapse Events
Player - Player 1 (Red) types a chat message containing ass as An exact match
Player - Player 2 (Blue) types a chat message containing ass as An exact match
Conditions
Collapse Actions
Game - Display to (All players) the text: ((Name of (Triggering player)) + is a bad person!)

Trigger:
Long Way To Ally
Collapse Events
Player - Player 1 (Red) types a chat message containing -ally red as An exact match
Player - Player 2 (Blue) types a chat message containing -ally red as An exact match
Conditions
Collapse Actions
Player - Make (Triggering player) treat Player 1 (Red) as an Ally with shared vision

Trigger:
Ally using Confusing Numbers
Collapse Events
Player - Player 1 (Red) types a chat message containing -ally as A substring
Player - Player 2 (Blue) types a chat message containing -ally as A substring
Collapse Conditions
(Substring((Entered chat string), 1, 5)) Equal to -ally
(Integer((Substring((Entered chat string), 7, 8)))) Greater than or equal to 1
(Integer((Substring((Entered chat string), 7, 8)))) Less than or equal to 12
Collapse Actions
-------- Get the above conditions by Integer Comparison, Convert String to Integer, Substring --------
Player - Make (Triggering player) treat (Player((Integer((Substring((Entered chat string), 7, 8)))))) as an Ally with shared vision
-------- Convert Player to Player Index for this action, and then the rest just like the conditions. --------

Trigger:
Ally using Player Names
Collapse Events
Player - Player 1 (Red) types a chat message containing -ally as A substring
Player - Player 2 (Blue) types a chat message containing -ally as A substring
Collapse Conditions
(Substring((Entered chat string), 1, 5)) Equal to -ally
Collapse Actions
Set StringVariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
Set PlayerGroupVariable = (All players matching ((Name of (Matching player)) Equal to StringVariable))
Player - Make (Triggering player) treat (Random player from PlayerGroupVariable) as an Ally with shared vision

Trigger:
Example Trigger Boot
Collapse Events
Player - Player 1 (Red) types a chat message containing -boot as A substring
Player - Player 2 (Blue) types a chat message containing -boot as A substring
Collapse Conditions
(Triggering player) Equal to AdminPlayer
(Substring((Entered chat string), 1, 5)) Equal to -boot
Collapse Actions
Set StringVariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
Set PlayerGroupVariable = (All players matching ((Name of (Matching player)) Equal to StringVariable))
Game - Defeat (Random player from PlayerGroupVariable) with the message: Boot!
__________________
Big plans...

Last edited by The)TideHunter( : 08-17-2006 at 02:44 PM.
The)TideHunter( is offline   Reply With Quote
Old 08-19-2006, 10:21 AM   #8
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,794

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default

Thanks, TideHunter for the triggers.
I've replaced the images, removed the color tags and approved the tutorial.
__________________
Zoom (requires log in)
PitzerMike is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 05:29 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2020, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services