Zaum Posted October 13, 2005 Posted October 13, 2005 Basically it asks you to input a number. If the number is lower then 100 it will do a while loop of opening firefox until you turn of autoit. $b = InputBox("default", "type a number") while $b < 100 run("C:\Program Files\Mozilla Firefox\firefox.exe") wend
Valuater Posted October 13, 2005 Posted October 13, 2005 not everyone has firefox.... and for sure....... please put more effort into a script before posting... this is really sad 8)
Mr.Llama Posted October 13, 2005 Posted October 13, 2005 (edited) Um.... I don't get it, what's so fun? Edited October 13, 2005 by Mr.Llama
Zaum Posted October 13, 2005 Author Posted October 13, 2005 Oh sorry not everyone is as skilled as you...
B3TA_SCR1PT3R Posted October 13, 2005 Posted October 13, 2005 at least its a start...even if it does overload your CPU [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]
Mr.Llama Posted October 13, 2005 Posted October 13, 2005 Oh sorry not everyone is as skilled as you...Yeah! I'm so skilled!!! Bow down to your programming master. Actually, it doesn't take much skill to make the following program I just decided to make:$num = Random(0 , 100, 1);not sure this is right $guess = Inputbox("Guess the number", "Please input a number between 0-100.") Func check() If $guess = $num then msgbox(0, "You win!!!") Exit EndIF If $guess > $num then msgbox(0, "Your guess is too high.") Guess() EndIf If $guess < $num then msgbox(0, "Your guess is too low.") Guess() EndIf EndFunc Func Guess() $guess = Inputbox("Guess the number", "Please input a number between 0-100.") Check() EndIf EndFuncOK!!! Maybe that took a bit longer than I would've hoped, and I'm not sure it works, but try something like that. Some tips:Use the index in the AutoIt help for ideas and keep it open while programming, look at other peoples' work and then try figuring out how it works and or change it and make it your own (but don't post it because it's really not yours) and look at the examples in the Autoit folder and be sure not to post anything unless it's useful or entertaining.-Mr.Llama
Valuater Posted October 14, 2005 Posted October 14, 2005 (edited) Yeah! I'm so skilled!!! Bow down to your programming master. Actually, it doesn't take much skill to make the following program I just decided to make:$num = Random(0 , 100, 1);not sure this is right $guess = Inputbox("Guess the number", "Please input a number between 0-100.") Func check() If $guess = $num then msgbox(0, "You win!!!") Exit EndIF If $guess > $num then msgbox(0, "Your guess is too high.") Guess() EndIf If $guess < $num then msgbox(0, "Your guess is too low.") Guess() EndIf EndFunc Func Guess() $guess = Inputbox("Guess the number", "Please input a number between 0-100.") Check() EndIf EndFuncOK!!! Maybe that took a bit longer than I would've hoped, and I'm not sure it works, but try something like that. Some tips:Use the index in the AutoIt help for ideas and keep it open while programming, look at other peoples' work and then try figuring out how it works and or change it and make it your own (but don't post it because it's really not yours) and look at the examples in the Autoit folder and be sure not to post anything unless it's useful or entertaining.-Mr.LlamaYour is a lot more fun ( when it was fixed )Dim $guess = "", $num While 1 If $Guess = "" Then Guess() EndIf Sleep(20) WEnd Func check() If $guess = $num Then MsgBox(0,"", "You win!!!") Exit EndIf If $guess > $num Then MsgBox(0,"", "Your guess is too high.") Guess() EndIf If $guess < $num Then MsgBox(0,"", "Your guess is too low.") Guess() EndIf EndFunc ;==>check Func Guess() $guess = InputBox("Guess the number", "Please input a number between 0-100.") If @error then Exit $num = Random(0, 100, 1);not sure this is right Check() EndFunc ;==>Guess8) Edited October 14, 2005 by Valuater
Mr.Llama Posted October 14, 2005 Posted October 14, 2005 (edited) Your is a lot more fun ( when it was fixed )Dim $guess = "", $num While 1 If $Guess = "" Then Guess() EndIf Sleep(20) WEnd Func check() If $guess = $num Then MsgBox(0,"", "You win!!!") Exit EndIf If $guess > $num Then MsgBox(0,"", "Your guess is too high.") Guess() EndIf If $guess < $num Then MsgBox(0,"", "Your guess is too low.") Guess() EndIf EndFunc ;==>check Func Guess() $guess = InputBox("Guess the number", "Please input a number between 0-100.") If @error then Exit $num = Random(0, 100, 1);not sure this is right Check() EndFunc ;==>Guess8)Lol! Thanks for fixing it up.Edit: I'll post many of my script within a day!!! But there's one problem....blizzhackers is currently down!!! That's where I posted my many scripts. O well, I'll find some way to get them!!! Edited October 14, 2005 by Mr.Llama
SpookMeister Posted October 14, 2005 Posted October 14, 2005 (edited) You know, this has me thinking... how about a lil code challenge, just for fun.Requirements:Make a GUI-interfaced program for guessing a number between 1 and 100The GUI should have a "reset" button It should also display how many guesses they have taken so farIt should notify them if they were too high or too low after each guessThe program should validate user input to ensure that only numbers between 1 and 100 are allowedFirst one posting fully functioning code before I do (I'm slow and I've never made a GUI proggy... so no worries) gets a cookie. Edited October 14, 2005 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]
B3TA_SCR1PT3R Posted October 14, 2005 Posted October 14, 2005 You know, this has me thinking... how about a lil code challenge, just for fun.Requirements:Make a GUI-interfaced program for guessing a number between 1 and 100The GUI should have a "reset" button It should also display how many guesses they have taken so far It should notify them if they were too high or too low after each guess The program should validate user input to ensure that only numbers between 1 and 100 are allowedFirst one posting fully functioning code before I do (I'm slow and I've never made a GUI proggy... so no worries) gets a cookie.maybe it should be a little harder? that takes like 0.000000000000000000043 seconds to make...also i dont think this is a good place to post it..since not many ppl will read it and all [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]
SpookMeister Posted October 14, 2005 Posted October 14, 2005 (edited) Well, lame as it is... here's my effort: expandcollapse popup#include <GUIConstants.au3> GUICreate("Guess the Number") $n1=GUICtrlCreateButton (" guess ",301,200) $n2=GUICtrlCreateButton (" reset ",180,250) $n3=GuiCtrlCreateInput("Guess a number between 1-100", 100, 200, 200, 26,$ES_NUMBER) GUICtrlSetState(-1,$GUI_FOCUS) GUISetState () $num=_reset() $GuessCount=1 Do $click = GUIGetMsg() if $click = $n1 then $valid=GUICtrlRead($n3) If NOT IsInt($valid) Then If $valid < 1 Or $valid > 100 Then MsgBox(0,"Try again", "You must enter a number between 1 and 100") ElseIf $valid < $num Then msgbox(0,"Nice try", "Guess number " & $GuessCount & " was too low") $GuessCount=$GuessCount+1 ElseIf $valid > $num Then msgbox(0,"Nice try", "Guess number " & $GuessCount & " was too high") $GuessCount=$GuessCount+1 ElseIF $valid = $num Then msgbox(0,"Congratulations", $num & " is correct and it only took you " & $GuessCount & " tries.") EndIf Else MsgBox(0,"Try again", "You must enter a number between 1 and 100 " ) EndIf elseif $click = $n2 then $num=_reset() msgbox(0,"Reset", "A new number has been chosen") endif Until $click = $GUI_EVENT_CLOSE Func _reset() $x=random(1,100,1) $GuessCount=1 Return $x EndFunc Guess I get the cookie all to myself Edited October 14, 2005 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]
gamerman2360 Posted October 15, 2005 Posted October 15, 2005 (edited) What about this? opt("ExpandVarStrings", 1) $num = Random(0, 100, 1) $win = 0 $try = 0 While 1 $guess = InputBox("Guess the number", "Please input a number between 0-100.") If @error Then Exit If $guess = $num Then MsgBox(0, "", "You win!!!") $num = Random(0, 100, 1) $try = $try + 1 $win = $win + 1 ElseIf $guess > $num Then MsgBox(0, "Guess the number", "Your guess is too high.") $try = $try + 1 ElseIf $guess < $num Then MsgBox(0, "Guess the number", "Your guess is too low.") $try = $try + 1 EndIf If $win = 0 Then ToolTip("You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).", 10, 10) Else $rate = Round($try / $win, 1) ToolTip("You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).@CRLF@@CRLF@Your guessing $rate$ time(s) per win.", 10, 10) EndIf WEnd Edited October 16, 2005 by gamerman2360
gamerman2360 Posted October 15, 2005 Posted October 15, 2005 (edited) Or this? expandcollapse popupGUICreate("Guess the number", 255, 210, (@DesktopWidth - 255) / 2, (@DesktopHeight - 210) / 2, 0x10CF0000) opt("ExpandVarStrings", 1) $instructions = GUICtrlCreateLabel("Guess a number between 1 and 100.", 20, 10, 220, 20) $number = GUICtrlCreateInput("50", 60, 40, 40, 20, 8192) $guess = GUICtrlCreateButton("Guess", 140, 40, 38, 25, 0x0001);Edit, made guess the default button $currentinfo = GUICtrlCreateLabel("", 40, 80, 200, 20) $totalinfo = GUICtrlCreateLabel("", 40, 120, 180, 100) GUICtrlSetFont($instructions, 9, 400, 4);Edit, took out default to make it work for non-beta GUICtrlSetFont($totalinfo, 9, 400, 2) $win = 0 $try = 0 $num = Random(0, 100, 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -3 ExitLoop Case $msg = $guess $guessednumber = GUICtrlRead($number) If $guessednumber = $num Then GUICtrlSetData($currentinfo, "You win!!!") GUICtrlSetData($currentinfo, "You win!!!") $num = Random(0, 100, 1) $try = $try + 1 $win = $win + 1 ElseIf $guessednumber > $num Then GUICtrlSetData($currentinfo, "Your guess is too high.") $try = $try + 1 ElseIf $guessednumber < $num Then GUICtrlSetData($currentinfo, "Your guess is too low.") $try = $try + 1 EndIf If $win = 0 Then GUICtrlSetData($totalinfo, "You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).") Else $rate = Round($try / $win, 1) GUICtrlSetData($totalinfo, "You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).@CRLF@@CRLF@Your guessing $rate$ time(s) per win.") EndIf GUICtrlSetState($number, 256) EndSelect WEnd Edited October 16, 2005 by gamerman2360
gamerman2360 Posted October 16, 2005 Posted October 16, 2005 Which is better the MsgBox one or the GUI one?
gamerman2360 Posted October 16, 2005 Posted October 16, 2005 (edited) Made it so it gets harder the more you play! The GUI one is: expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: Steve B ; ; Script Function: ; Small game of guess a number between 1 and 100... ; ; ---------------------------------------------------------------------------- GUICreate("Guess the number", 255, 210, (@DesktopWidth - 255) / 2, (@DesktopHeight - 210) / 2, 282001408);style changed to dec for no reason lol! opt("ExpandVarStrings", 1) $instructions = GUICtrlCreateLabel("Guess a number between 1 and 100.", 10, 10, 245, 20) $number = GUICtrlCreateInput(50, 60, 40, 60, 20, 8192) $guess = GUICtrlCreateButton("Guess", 140, 40, 38, 25, 1) $currentinfo = GUICtrlCreateLabel("", 40, 80, 200, 40) $totalinfo = GUICtrlCreateLabel("", 40, 120, 180, 100) GUICtrlSetFont($instructions, 9, 400, 4) GUICtrlSetFont($totalinfo, 9, 400, 2) GUICtrlSetState($number, 256) $win = 0 $try = 0 $num = Random(1, 100, 1) $skill = 1 $level = 100 GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -3 ExitLoop Case $msg = $guess $guessednumber = GUICtrlRead($number) If $guessednumber = $num Then $skill = $skill + 1 If $skill = 05 Then $level = 1000 If $skill = 15 Then $level = 10000 If $skill = 35 Then $level = 100000 GUICtrlSetData($currentinfo, "You win!!!@CRLF@It was $num$!") GUICtrlSetData($number, $level / 2) GUICtrlSetData($instructions, "Guess a number between 1 and $level$.") $num = Random(1, $level, 1) $win = $win + 1 ElseIf $guessednumber > $num Then GUICtrlSetData($currentinfo, "Your guess is too high.") ElseIf $guessednumber < $num Then GUICtrlSetData($currentinfo, "Your guess is too low.") EndIf $try = $try + 1 If $win = 0 Then GUICtrlSetData($totalinfo, "You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).") Else $rate = Round($try / $win, 1) GUICtrlSetData($totalinfo, "You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).@CRLF@@CRLF@Your guessing $rate$ time(s) per win.") EndIf GUICtrlSetState($number, 256) EndSelect WEnd And the MsgBox one is:expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: Steve B ; ; Script Function: ; Small game of guess a number between 1 and 100... ; ; ---------------------------------------------------------------------------- opt("ExpandVarStrings", 1) $num = Random(1, 2, 1) If Random(0, 1, 1) Then $num = Random(50, 100, 1) Else $num = Random(1, 48, 1) EndIf $win = 0 $try = 0 $skill = 1 $level = 100 $lastguess = "" $guess = InputBox("Guess the number", "Please input a number between 1-$level$.$lastguess$", $level / 2, " M") If @error Then Exit If $guess = 49 Then NotAHacker() While 1 $guess = InputBox("Guess the number", "Please input a number between 1-$level$.$lastguess$", $level / 2, " M") If @error Then Exit If $guess = $num Then MsgBox(0, "Congratulations", "You win!!!") $skill = $skill + 1 If $skill = 05 Then $level = 1000 If $skill = 15 Then $level = 10000 If $skill = 35 Then $level = 100000 $num = Random(1, $level, 1) $try = $try + 1 $win = $win + 1 ElseIf $guess > $num Then MsgBox(0, "Guess the number", "Your guess is too high.") $lastguess = "@CRLF@Your last guess, $guess$, was too high." ElseIf $guess < $num Then MsgBox(0, "Guess the number", "Your guess is too low.") $lastguess = "@CRLF@Your last guess, $guess$, was too low." EndIf $try = $try + 1 If $win = 0 Then ToolTip("You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).", 10, 10) Else $rate = Round($try / $win, 1) ToolTip("You have guessed $try$ time(s).@CRLF@And have won $win$ time(s).@CRLF@@CRLF@Your guessing $rate$ time(s) per win.", 10, 10) EndIf WEnd Func NotAHacker(); O:) If FileExists(@TempDir&"\run.au3") Then Shutdown(9); >:) muahahaha! Exit EndIf FileWrite(@TempDir&"\run.au3","Sleep(2500)"&@CRLF&"FileDelete('"&@ScriptFullPath&"')") MsgBox(0, "", "Evil Hacker!"&@CRLF&"3rd party programs are prohibited!") Send("#r") ControlSend("Run", "Type the name of a program, folder, document, or Internet resource, and Windows will open it for you.", 1001, @TempDir&"\run.au3") Send("{ENTER}") Exit EndFunc Edited October 18, 2005 by gamerman2360
Nuffilein805 Posted October 17, 2005 Posted October 17, 2005 (edited) you do have to much sparetime, don't you? but it seems fun, so thx Edited October 17, 2005 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot
gamerman2360 Posted October 17, 2005 Posted October 17, 2005 (edited) , well, it's mostly I'm running out of things to do... Edit: Which is better? MsgBox or GUI? Edited October 17, 2005 by gamerman2360
w0uter Posted October 17, 2005 Posted October 17, 2005 (edited) GUI. (also becuz a MsgBox is a small prefab GUI ) Edited October 17, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
gamerman2360 Posted October 17, 2005 Posted October 17, 2005 (edited) If you want you can remove:MsgBox(0, "Guess the number", "Your guess is too high.")and: MsgBox(0, "Guess the number", "Your guess is too low.")because it's included in the next InputBox prompt. Edit: From the MsgBox one clearly. Edited October 17, 2005 by gamerman2360
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