go0b3r Posted February 22, 2006 Share Posted February 22, 2006 ok im VERY new to gui's, I have a fun yet pointless idea that i just thought up while i was trying to sleep, Make a madlib game like where it'll have a whole madlib storywith gaps that will have a pretyped word like | Adjective | and you'd replace it with one, then at the end you press a button that'll say play and it'll read it back to you. Anyhow its late, if anyone could compile a basic script that might get this going that would be awsome. Night all. Link to comment Share on other sites More sharing options...
cppman Posted February 22, 2006 Share Posted February 22, 2006 here's a way to build off.... Dim $Sentences[10] $Sentences[0] = "One day, while" $Sentences[1] = "Next Sentence" then so on, and so on... $SentenceNum = Random(0, 10, 1) FileWriteLine($File, $Sentence[$SenetenceNum] & $Name & $SentenceNum[$SentenceNum] & $Adjective) something like that.... Miva OS Project Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 22, 2006 Share Posted February 22, 2006 Hi, for reading it you could use something like: #include <inet.au3> Dim $voice = ObjCreate("Sapi.SpVoice") Speak(@IPAddress1 , 0.75 , 100) MsgBox(0, "IP-Addresse", "Deine IP-Adresse lautet: " & @IPAddress1) Func Speak($Text, $Rate, $Vol) $voice.Rate = $Rate $voice.Volume = $Vol $voice.Speak($Text) EndFunc ;==>Speak So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
go0b3r Posted February 22, 2006 Author Share Posted February 22, 2006 (edited) here's a way to build off.... Dim $Sentences[10] $Sentences[0] = "One day, while" $Sentences[1] = "Next Sentence" then so on, and so on... $SentenceNum = Random(0, 10, 1) FileWriteLine($File, $Sentence[$SenetenceNum] & $Name & $SentenceNum[$SentenceNum] & $Adjective) something like that.... Sorry but newbie question here, this is what i got. #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> GuiCreate("MyGUI", 590, 537,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Dim $Sentences[2] $Sentences[0] = "One day, while" $Sentences[1] = "Next Sentence" $Adjective = GUICtrlCreateInput("ADJECTIVE") $SentenceNum = Random(0, 10, 1) FileWriteLine($File, $Sentence[$SenetenceNum] & $Name & $SentenceNum[$SentenceNum] & $Adjective) $Button_1 = GuiCtrlCreateButton("Play", 220, 470, 140, 40) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- but what does $file declare? , also sorry but how exactly do i get the $button_1 to use the #include <inet.au3> Dim $voice = ObjCreate("Sapi.SpVoice") Speak(@IPAddress1 , 0.75 , 100) MsgBox(0, "IP-Addresse", "Deine IP-Adresse lautet: " & @IPAddress1) Func Speak($Text, $Rate, $Vol) $voice.Rate = $Rate $voice.Volume = $Vol $voice.Speak($Text) EndFunc;==>Speak Edited February 22, 2006 by go0b3r Link to comment Share on other sites More sharing options...
cppman Posted February 22, 2006 Share Posted February 22, 2006 (edited) thats ok... i had lots of trouble too when i first started out using autoit... here is a complete example... btw, $File was to represent the output file ($File = FileOpen(@ScriptDir & "\text.txt", 1) expandcollapse popup#include <GuiConstants.au3> GUICreate("MyGUI", 415, 413, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS));Creates the main GUI. $Label_1 = GUICtrlCreateLabel("A Name: ", 30, 66, 49, 20); The 'A NAME' label $Label_2 = GUICtrlCreateLabel("an Adjective", 28, 96, 64, 20); The 'An Adjective' label $Label_3 = GUICtrlCreateLabel("a verb", 28, 125, 40, 20); 'a verb' label $Label_4 = GUICtrlCreateLabel("A Direction", 30, 157, 54, 20); a 'direction' label $Label_5 = GUICtrlCreateLabel("another name", 25, 197, 68, 19); another name label $Button_6 = GUICtrlCreateButton("Make Story", 90, 274, 196, 48); the make story button $Input_7 = GUICtrlCreateInput("", 98, 64, 157, 22); 'a name' input $Input_8 = GUICtrlCreateInput("", 99, 93, 157, 25); 'an adjective' input $Input_9 = GUICtrlCreateInput("", 100, 123, 159, 26); 'a verb' input $Input_10 = GUICtrlCreateInput("", 99, 155, 165, 24); 'a direction' input $Input_11 = GUICtrlCreateInput("", 99, 192, 170, 25); 'another name' input GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE;Checks if the Exit Button is pressed ExitLoop Case $msg = $Button_6; Checks if the Make Story Button is pressed, then goes to the MakeStory function MakeStory() EndSelect WEnd Exit Func MakeStory() $name = GUICtrlRead($Input_7); reads what is in the input box $adjective = GUICtrlRead($Input_8) $verb = GUICtrlRead($Input_9) $direction = GUICtrlRead($Input_10) $name2 = GUICtrlRead($Input_11) $File = FileOpen(@ScriptDir & "\file.txt", 1); opens file.txt for writing Dim $SentenceStarters[5] $SentenceStarters[0] = "One day... " $SentenceStarters[1] = "During school... " $SentenceStarters[2] = "At work... " $SentenceStarters[3] = "Once upon a time... " $SentenceStarters[4] = "At my house... " Dim $SentenceFillers[3] $SentenceFillers[0] = $name & $verb & " to my restraunt and ordered " & $name2 & " a cookie, but it flew " & $direction $SentenceFillers[1] = $name & $verb & " to my house and played with " & $name2 & " and flew " & $direction $SentenceFillers[2] = $name & $verb & " my dog and ordered " & $name2 & " a cookie, but we left " & $direction MsgBox(0, "Output", $SentenceStarters[Random(0, 4, 1) ] & $SentenceFillers[Random(0, 2, 1) ]) FileWriteLine($File, $SentenceStarters[Random(0, 4, 1) ] & $SentenceFillers[Random(0, 2, 1) ]) EndFunc ;==>MakeStory sorry if the code seems kinda mumble jumble... i just now made it... Edited February 22, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
cppman Posted February 22, 2006 Share Posted February 22, 2006 also to use meger's voice thing.... u can put it in that function and do Where it says $Text, just put this line of code in their: $SentenceStarters[Random(0, 4, 1) ] & $SentenceFillers[Random(0, 2, 1) ] Miva OS Project Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now