|
| 21 Jun 2012 09:27 PM |
I'm trying to make a script where it has random choices to say things. For instance, it would have a set of nouns and verbs, and a player. It would say
(Player) (verb/ed) (Preposition maybe?) (Name's) (noun).
So let's make a list of players.
PLAYERS Pieguardian Andmeister
VERBS ran jumped
PREPOSITIONS On Over
NOUNS Bike Hospital
So let's say it chooses random words to fill the correct spots so it could say something following that pattern described above,
"Pieguardian ran over Andmeister's hospital!"
This would make so much more sense if I could describe the game I was making that required this script. I need it to go off every so often so it keeps the game going. I'd say every fifteen minutes. Can someone just give me a place to start? Not do the script for me, but start it and I can try the rest? If I can't, I might come back for help. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 09:28 PM |
I would suggest to store all the possible words in a table. Sorry if not much help, I'm not as advanced on the manner.
~Leave me in the city with 50 bucks and watch me come back a millionaire~ |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 09:28 PM |
"This would make so much more sense if I could describe the game I was making that required this script."
I can't, because I don't want any ideas taken. However, I will give you an in-game credit GUI if you help me. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 09:30 PM |
You should also make the table something simple to remember, if you might use it later on.
Words = {"table", etc. etc}
~Leave me in the city with 50 bucks and watch me come back a millionaire~ |
|
|
| Report Abuse |
|
|
| |
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 21 Jun 2012 09:32 PM |
| Save the preset words in different tables and then make it choose a random word from each table to construct your random statement. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 09:32 PM |
And if you take a look at sword fight tournament scripts, you might see they use a system SIMILAR to making randomized messages, except the message shows what map is chosen, etc. But that might get you on a better track as well.
~Leave me in the city with 50 bucks and watch me come back a millionaire~ |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 11:02 PM |
It would be more helpful if you told us the actual idea, but I'll respect your decision to keep it private, and use your examples. Anyways, as Green suggested, I would use tables. Might be a better way, but I would do something like:
Players = {"Pieguardian", "Andmeister"} Verbs = {"ran", "jumped"} Preps = {"on", "over"} Nouns = {"bike", "hospital"} while wait(900) do local Player = Players[math.random(1, #Players)] local Player2 = Players[math.random(1, #Players)] local Verb = Verbs[math.random(1, #Verbs)] local Prep = Preps[math.random(1, #Preps)] local Noun = Nouns[math.random(1, #Nouns)] local m = Instance.new("Message", Workspace) m.Text = Player.. " " ..Verb.. " " ..Prep.. " " ..Player2.. "'s " ..Noun.. "." wait(5) m:Destroy() end
Top of my head and untested, but you should get the gist of it. † KMXD †
|
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 11:15 PM |
| @Knightmare... DARN YOU!!! I started making a script myself then I glanced back and you had already finished one xD!! |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 08:48 AM |
@Knight,
Thank you for your help. However, the script doesn't work. :c I already had tables so I tried to edit it to that. I think I succeeded. I just changed my table's name. Could it be that you put "while wait(900)" instead of "wait(900)?"
Players = {"Pieguardian", "Andmeister"} Verbs = {"ran", "jumped"} Preps = {"on", "over"} Nouns = {"bike", "hospital"} while wait(900) do local Player = Players[math.random(1, #Players)] local Player2 = Players[math.random(1, #Players)] local Verb = Verbs[math.random(1, #Verbs)] local Prep = Preps[math.random(1, #Preps)] local Noun = Nouns[math.random(1, #Nouns)] local m = Instance.new("Message", Workspace) m.Text = Player.. " " ..Verb.. " " ..Prep.. " " ..Player2.. "'s " ..Noun.. "." wait(5) m:Destroy() end |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 08:53 AM |
@pie
while wait() do end is the same as while true do wait() end
It just shortens it.
~Moo~ Happie birth dai to meh! ~Moo~ |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jun 2012 08:57 AM |
This might be a little late, but:
Players = {"Pieguardian", "Andmeister"} Verbs = {"ran", "jumped"} Preps = {"on", "over"} Nouns = {"bike", "hospital"}
while true do local Player = Players[math.random(1, #Players)] local Player2 = Players[math.random(1, #Players)] local Verb = Verbs[math.random(1, #Verbs)] local Prep = Preps[math.random(1, #Preps)] local Noun = Nouns[math.random(1, #Nouns)] local m = Instance.new("Message", Workspace) m.Text = Player.. " " ..Verb.. " " ..Prep.. " " ..Player2.. "'s " ..Noun.. "." print(m.Text) wait(5) m:Destroy() end
works. :/ |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 08:59 AM |
@Ninja,
I'll try it. Thank you! |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 09:09 AM |
@Ninja,
It works! Thank you! One last question, if I want it to repeat, should I put this below the "end?"
wait(900) then repeat
|
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 09:12 AM |
Erm maybe this for example of 1 table;
Nouns={"Apple","Cake","Computer"}
object=Nouns[math.random(1,#Nouns)]
print(object)
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 09:13 AM |
@Pieguardian, for a repeat:
time=60 --Time between switches in seconds. while wait(time) do Players = {"Pieguardian", "Andmeister"} Verbs = {"ran", "jumped"} Preps = {"on", "over"} Nouns = {"bike", "hospital"} while true do local Player = Players[math.random(1, #Players)] local Player2 = Players[math.random(1, #Players)] local Verb = Verbs[math.random(1, #Verbs)] local Prep = Preps[math.random(1, #Preps)] local Noun = Nouns[math.random(1, #Nouns)] local m = Instance.new("Message", Workspace) m.Text = Player.. " " ..Verb.. " " ..Prep.. " " ..Player2.. "'s " ..Noun.. "." print(m.Text) wait(5) m:Destroy() end end
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 09:14 AM |
Also, yes I did use the other guy's code.
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ)
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 09:16 AM |
@Teh,
Thank you! I will give you guys credit in the game. Tell me if I forget you. I'll link to the game when I'm done. |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 10:18 AM |
@Teh,
It doesn't seem to work. |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 22 Jun 2012 11:05 AM |
Teh's code should work or just try this.
Players = {"Pieguardian", "Andmeister"} Verbs = {"ran", "jumped"} Preps = {"on", "over"} Nouns = {"bike", "hospital"}
while wait(900) do local Player = Players[math.random(1, #Players)] local Player2 = Players[math.random(1, #Players)] local Verb = Verbs[math.random(1, #Verbs)] local Prep = Preps[math.random(1, #Preps)] local Noun = Nouns[math.random(1, #Nouns)] local m = Instance.new("Message", Workspace) m.Text = Player.. " " ..Verb.. " " ..Prep.. " " ..Player2.. "'s " ..Noun.. "." print(m.Text) wait(5) m:Destroy() end |
|
|
| Report Abuse |
|
|
| |
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
| |
|
|
| 22 Jun 2012 12:38 PM |
@White,
Sorry, I meant to say thank you in that message, but then there was a floodcheck so I had to wait. :c
So thank you! :D
Only one last question, how can I get users to be the people in the game. |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 22 Jun 2012 12:40 PM |
| Make it get the list of Players in the game by using an onEntered Event so it can add each new player to the list and also remove people from the list if they leave. |
|
|
| Report Abuse |
|
|