HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Text Triggered Random Text Messages, How?

11-10-2002, 09:34 AM#1
Guest
What I would like to do is set up a trigger, in this instance "-dark jojo", that when triggered will pick and return a random text message from a group of 20 to 30 text messages. How would I accomplish this?

Example:

User: -dark jojo
Return: Dark JoJo loves you!

User: -dark jojo
Return: Dark JoJo hates the original version of this map made by dirtbikr59 ([email protected])

User: -dark jojo
Return: Stop Kitty Porn!

User: -dark jojo
Return: WC3campaigns.com has the best Warcraft forums on the net. They blow the battle.net forums away with knowledgable members and the biggest group of mod makers around!

I think you get the idea of what I'm shooting at here. Any help is highly appreciated.
11-10-2002, 09:47 AM#2
Ari
Take a look at the deathsheep map. They have something like this. To implement, they have an event which reacts to the input text. Next they create a random number between 1 to 10 (or whatever). Finally they have a series of if...then statements:

if randomnumber = 1 then display "random message 1"
if randomnumber = 2 then display "random message 2"
etc

hope this helps.
11-10-2002, 10:27 AM#3
Guest
i am not at my home computer right now so I cannot check out the deathsheep map. Ari do you know, or anybody else, how you would create that random number? Would it be a variable? And if so how would it be? I understand the rest and could impliment it... i think. I'd have to sit down with the editor. Thanks ari.
11-10-2002, 10:37 AM#4
Insaniteus
Set Integer Variable = Math Random Number between 1 and 30

Then just run a shitload of If statement checking to see if the Variable equals that comment's number.

-Insaniteus-
-------------------I think I've posted in EVERY thread you've ever started lol :sweatdrop !
11-10-2002, 11:42 AM#5
Guest
For the text trigger would I be able to have an event which says If any player types "-dark jojo" then ACTION or would I need to define each player in the events. I know it doesn't make much of a difference but the less triggers the better in my opinion.

*EDIT 1*
Okay I'm confused. If I use the If/Then/Else statements then I obviously do not need to use an event for the text trigger and anybody typing the message would trigger it but I would like it to be setup like this:


If a player types "-dark jojo" then I want that player and only that player to see the resulting message. So what would a trigger with only one statement look like, just for examples sake.

Event
- ???

Condition
- ???

Action
- ???


*EDIT 2*
Oh yeah, one last thing. When you are specifying a chat string and you can select between it being "an exact match" or "is a substring", how does substring work?

*EDIT 3*
Quote:
I think I've posted in EVERY thread you've ever started lol :sweatdrop !

:ggani: I'm not sure if you've caught every one since the first time I ever saw you was when you announced your movie and I've been seeking help for quite a while BUT I think you've caught the last 50% haha. I really appreciate your insight and help. I swear I impliment more than half of the answers you give me and take ALL of your feedback into heavy consideration. Thanks for the ongoing support and as I said in my post on your cinimatic thread, YOUR MOVIE F**KING ROCKED NUTS INTO SUB-SPACE!!! Outstanding work!! :ggani:
11-10-2002, 04:14 PM#6
Jeltz
Random is an integer. You need one event for each player if I am not misstaken.

Event
-Player - Player 1 types achat message containing -dark jojo as An exact match
-Player - Player 2 types achat message containing -dark jojo as An exact match
-Player - Player 3 types achat message containing -dark jojo as An exact match
-Player - Player 4 types achat message containing -dark jojo as An exact match

Action
-Set Random = Random integer between 1 and 4
-If Random Equal to 1 then do (Game - Display to (All players matching ((Matching player) Equal to (Triggering player)) the text: Dark JoJo loves you! )else do (Do Nothing)
-If Random Equal to 2 then do (Game - Display to (All players matching ((Matching player) Equal to (Triggering player)) the text: Stop Kitty Porn! )else do (Do Nothing)
-If Random Equal to 3 then do (Game - Display to (All players matching ((Matching player) Equal to (Triggering player)) the text: Dark JoJo hates the original version of this map made by dirtbikr59 ([email protected]) )else do (Do Nothing)
-If Random Equal to 4 then do (Game - Display to (All players matching ((Matching player) Equal to (Triggering player)) the text: WC3campaigns.com has the best Warcraft forums on the net. They blow the battle.net forums away with knowledgable members and the biggest group of mod makers around! )else do (Do Nothing)
11-11-2002, 01:43 AM#7
Guest
Jeltz your the man. Thank you so much for taking the time to type all of that out for me. Its a tremendous help in the ongoing learning process. You just eliminated a good hour of trial and error for m. Cheers :D
11-11-2002, 07:35 AM#8
Saik
First, create a String Variable and tick the "array" box. le

Variable Name | Variable Type | Initial Value
___darkjojo ______String Array_____-None-

Then create a trigger with

Events
Map Initialization

Condition

Action
Set darkjojo[0] = Dark JoJo loves you!
Set darkjojo[1] = Dark JoJo hates the original version of this ...
Set darkjojo[2] = Stop Kitty Porn!
Set darkjojo[3] = WC3campaigns.com has the best Warcraft ...
Set darkjojo[4] = blah

and on and on for all your other messages

then when you want it to display just have

Action
Display to (All players) the text: darkjojo[(Random integer between 0 and *# of last message*)]

would display the random message, compressing all the messy if else statements into one line of code :gsmile:
11-11-2002, 08:29 AM#9
ChronOmega
darn he beat me to it but sure enough thats the way to go. thats why arrays are cool
11-11-2002, 08:57 PM#10
Jeltz
Damn how could I forget that. My brain must have been malfunctioning.
11-13-2002, 09:06 AM#11
Guest
Hehe kick ***. I love these forums. Thank you very very very much :D