HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Chat Message Help

02-02-2006, 11:26 PM#1
ixmike88
Is there anyway to make an event which would check if red types a message in general, because for my map I need it so he can choose any number of his choice, and I don't see anything which allows me to do this in the Event - Chat Message trigger.

Thanks
02-02-2006, 11:33 PM#2
Orc Dork
Here it is

Trigger:
Player - Player 1 (Red) types a chat message containing (text) as An exact match



A great man one said, "Give rep to those who help you" *wink wink*
02-02-2006, 11:38 PM#3
johnfn
I think you should try

Trigger:
Player - Player 1 (Red) types a chat message containing (<Empty String>) as An exact match


Be wary, for some reason I've heard this may cause server splits. If that doesn't work and you're feeling lazy, try this

Trigger:
For each (Integer A) from 1 to 10, do (Actions)
Collapse Loop - Actions
Trigger - Add to (Your Trigger) the event (Player - Player 1 (Red) types a chat message containing (String((Integer A))) as An exact match)
02-02-2006, 11:53 PM#4
ixmike88
Quote:
Originally Posted by Orc Dork
Here it is

Trigger:
Player - Player 1 (Red) types a chat message containing (text) as An exact match



A great man one said, "Give rep to those who help you" *wink wink*


"text" as the parameter would be anything typed?
02-02-2006, 11:58 PM#5
Taur
well actually empty string will do anything, but it can be buggy. WEU comes with a player types any string message event but I can't seem to figure out how to actually get that string message. If it's single player I think John's way might work.
02-03-2006, 01:28 AM#6
ixmike88
Well this code was designed for only one person input, this is what it looks like, give me some feedback please:

02-03-2006, 05:18 AM#7
PCPharaoh
I'm sorry to say that that is a horridly bad trigger.
Trigger:
Melee Initialization
Collapse Events
Player - Player 1 (Red) types a chat message containing -settime as A substring
Conditions
Collapse Actions
Set tempinteger = (Integer((Substring((Entered chat string), 10, (Length of (Entered chat string))))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
tempinteger Equal to 0
Collapse Then - Actions
Game - Display to (All players) the text: Error: Invalid Inpu...
Collapse Else - Actions
Game - Display to (All players) the text: (Game Length set to: + ((String(tempinteger)) + minutes!))
Set PeriodLength = (tempinteger x 3)
Trigger - Turn off (This trigger)

If you don't ever use the trigger in the map after it sets PeriodLength, then I suggest that you use:
Trigger:
Collapse Actions
Custom script: call DestroyTrigger(GetTriggeringTrigger())

Collapse And NOT,
Trigger - Turn off (This trigger)
02-03-2006, 11:00 AM#8
Anitarf
I don't see why that should make the trigger "horridly bad". It's just inefficient, but it should work. Besides, your trigger doesn't cap the game time to 60 minutes like his.
02-03-2006, 11:54 AM#9
Blade.dk
Quote:
Originally Posted by Orc Dork
A great man one said, "Give rep to those who help you" *wink wink*

And another man said, that asking for rep in every post sucks, even though you should.

Quote:
Originally Posted by johnfn
Trigger:
For each (Integer A) from 1 to 10, do (Actions)
Collapse Loop - Actions
Trigger - Add to (Your Trigger) the event (Player - Player 1 (Red) types a chat message containing (String((Integer A))) as An exact match)

Because you use as "An exact match", it will only work if the text contains 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10, which means that it wouldn't work with higher numbers. I would use this:

Trigger:
For each (Integer A) from 0 to 9, do (Actions)
Collapse Loop - Actions
Trigger - Add to (Your Trigger) the event (Player - Player 1 (Red) types a chat message containing (String((Integer A))) as A substring)
02-03-2006, 07:32 PM#10
ixmike88
GAMELENGTH and PERIODLENGTH are two different variables.

I have other checks in other triggers, heres the whole thing:


and




EDIT:

PC, I don't know any type of customscript/JASS to be doing that so I used Turn off this trigger, what's wrong with it? :o

Anitarf, how could I make my triggers more efficient? :P
02-03-2006, 08:58 PM#11
Anitarf
Quote:
Originally Posted by ixmike88
Anitarf, how could I make my triggers more efficient? :P
Don't bother, it runs like once in the whole game. Just put this custom script line to the spot where you turn the trigger off:
custom script: call DestroyTrigger( GetTriggeringTrigger() )
02-03-2006, 09:01 PM#12
ixmike88
How is that better than Turn Off trigger?
02-03-2006, 09:05 PM#13
Anitarf
Well, it destroys the trigger, so it's not in memory any more... It has been reported that destroying single-use triggers once they are no longer needed improoves map performance, especially in the cases of very long initialization triggers.
02-03-2006, 09:08 PM#14
ixmike88
Alright, thank you.