James Posted July 31, 2007 Share Posted July 31, 2007 Hey,I know about my other topic, but this is a different question, so I thought it would be easier to start a new topic, so its easier to search for at a later date Basically, I am making a game for a primary school (They dont know about it yet, but I said I would).In the GUI there is a star with 1 number in each corner. The numbers range from 1-6. The aim of the game is to try and reach the number that is randomly generated from a series of 20 different possible numbers by using a number once and using the four basic symbols /*-+Example:The number I have to make is 22. I know that doing 5*4+2=22, so I enter it into the box. I then click a button which will look at the equation I have entered and it will check if I have used a number once. You dont need to use all the numbers but you need to use them once. It will then check against the number generated and if it is correct a message box appears, and you get a sound played.Here is the variable names that I use:$ToMake ; The number that is randomly generated $NumberEntry ; The input box to check for equationI can show you what I have done so far if anyone needs it.Thanks,James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 31, 2007 Share Posted July 31, 2007 HI, and where is the prop? A start: $toget = 22 If Execute(InputBox('Test', '')) = $toget Then MsgBox(1, "WIN", 'You did it!') Else MsgBox(1, "Lost", 'NO!!') EndIf Just need to parse the Input 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...
James Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) and where is the prop?Where is the what? $toget = 22 If Execute(InputBox('Test', '')) = $toget Then MsgBox(1, "WIN", 'You did it!') Else MsgBox(1, "Lost", 'NO!!') EndIfoÝ÷ Ù±Ò!j÷§£(µ«¢+ÙÕ¹5Ñ ¤($ÀÌØí55ôÕ¥ ÑɱI ÀÌØíQ½5¤(%%áÕÑ¡Õ¥ ÑɱI ÀÌØí9յɹÑÉ䤤ôÀÌØí55Q¡¸(5Í ½à Ä°ÅÕ½Ðí]%8ÅÕ½Ðì°Ìäíe½Ô¥¥ÐÌÌìÌäì¤)±Í(5Í ½à Ä°ÅÕ½Ðí1½ÍÐÅÕ½Ðì°Ìäí9 And now it will calculate, its just the problem of checking if a number has been used more than once. Edited July 31, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 31, 2007 Share Posted July 31, 2007 Hi, prob = problem. You can use RegExp oder Strinsplit and then StringCount or StringReplace 1 by 1 and check extended. 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...
James Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) That was what I was trying to do. Thanks I now have the functions needed. Thanks again MG(Its much easier)Where can I find StringCount? - Oh you mean StringLen() Edited August 1, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 31, 2007 Share Posted July 31, 2007 Hi, are you done with it? My girlfriend works at an elementary school, maybe she has need for the game, too. 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...
James Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) No not quite. I am trying atm to make, whatever you put into the input is taken from the Number you need to make. Example time: Number to make: 20 Inside the input: 5*3 (15) 15 is taken from the number to make. Any help? Edited August 1, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 OK, so far I have got, Func RealTime() Local $OldStr $ToMakeRead = GuiCtrlRead($ToMake) $MathRead = GuiCtrlRead($NumberEntry) For $i = 1 To $MathRead If $ToMakeRead <> $OldStr Then GuiCtrlSetData($ToMake, $ToMakeRead =- $MathRead) EndIf $OldStr = $MathRead Next EndFunc But that keeps returning the word False. I am guessing that the function would be called in the Case statement for the input $NumberEntry. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 (edited) Now I am really confused. Using the following: $ToMakeRead = GuiCtrlRead($ToMake) $MathRead = GuiCtrlRead($NumberEntry) GuiCtrlSetData($ToMake, $ToMakeRead =- Execute($MathRead))oÝ÷ ØHêëzÛ«Ê®¢Ôë¹ê®¢Ú+ªê-©lz«¨·rËajÓhÀ!jxv+Zn+m¡«¢+Ø$ÀÌØíQ½5IôÕ¥ ÑɱI ÀÌØíQ½5¤($ÀÌØí5Ñ¡IôÕ¥ ÑɱI ÀÌØí9յɹÑÉä¤(%Õ¥ ÑɱMÑÑ ÀÌØíQ½5°$ÀÌØíQ½5I´ÀÌØí5Ñ¡I And now it takes what ever you enter into the box away, but it keeps going. It doesn't do it once. Please someone help me. Edited August 1, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 Anyone? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 I have again tried this, using: Func RealTime() $ToMakeRead = GuiCtrlRead($ToMake) $MathRead = GuiCtrlRead($NumberEntry) ;For $i = 1 to $MathRead ; GuiCtrlSetData($ToMake, $ToMakeRead +- Execute($MathRead)) ;Next ;nGuiCtrlSetData($ToMake, Execute(GuiCtrlRead($ToMake)) - Execute(GuiCtrlRead($NumberEntry))) Local $OldStr If $ToMakeRead <> $OldStr Then GuiCtrlSetData($ToMake, $ToMakeRead - Execute($MathRead)) EndIf $OldStr = $MathRead EndFunc The commented out is what I have already tried. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 1, 2007 Share Posted August 1, 2007 This seemed like fun, so here's my take at it: expandcollapse popupWhile 1 $ToMake = Random(20, 40, 1) $Input = InputBox("Math game", "Enter forumla using numbers 1 through 6 to make: " & $ToMake) If @error = 1 Then Exit If $Input = "" Then MsgBox(0, "Error", "Please input an equation!") Else $check = Check($Input) If $check = False Then ContinueLoop Else If Execute($Input) = $ToMake Then MsgBox(0, "Hurrah", "You got it!") ExitLoop Else MsgBox(0, "Aww", "That's incorrect, try again!") EndIf EndIf EndIf WEnd Func Check($sText = "") Local $searchBefore = -1, $searchAfter = -1, $temp = "", $j = 1 $sText = StringSplit($sText, "") For $i = 1 To $sText[0] $temp = Number($sText[$i]) If $temp = 0 Then If $sText[$i] = "*" Then ContinueLoop ElseIf $sText[$i] = "/" Then ContinueLoop ElseIf $sText[$i] = "-" Then ContinueLoop ElseIf $sText[$i] = "+" Then ContinueLoop Else MsgBox(0, "Error", "Inavlid character in forumla!") Return False EndIf ElseIf $temp > 6 Then MsgBox(0, "Error", "You used a number outside the required range!") Return False Else If StringInStr($Input, $sText[$i], 0, 2) Then MsgBox(0, "Error", "You used the same value more than once! Try again.") Return False EndIf EndIf $j += 1 Next Return True EndFunc IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 Thankyou so much mike I will add that tomorrow. Any advice/help on the other question? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 1, 2007 Share Posted August 1, 2007 Hmm....sorry, what's your current issue? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 (edited) I am trying atm to make, whatever you put into the input is taken from the Number you need to make. Example time: Number to make: 20 Inside the input: 5*3 (15) 15 is taken from the number to make. Any help? Edited August 1, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 1, 2007 Share Posted August 1, 2007 Like this? $ToMake = 20 $Input = 5 * 5 $ToMake -= $Input MsgBox(0, "", $ToMake) Btw, 5*5 = 25, not 15. You sure you're making this for grade schoolers and not to test yourself? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 Lol sorry, quick typing. Look: Func RealTime() $ToMakeRead = GuiCtrlRead($ToMake) $MathRead = GuiCtrlRead($NumberEntry) ;For $i = 1 to $MathRead GuiCtrlSetData($ToMake, $ToMakeRead =- $MathRead) ;Next ;nGuiCtrlSetData($ToMake, Execute(GuiCtrlRead($ToMake)) - Execute(GuiCtrlRead($NumberEntry))) ;Local $OldStr ;If $ToMakeRead <> $OldStr Then ;GuiCtrlSetData($ToMake, $ToMakeRead - Execute($MathRead)) ;EndIf ;$OldStr = $MathRead EndFunc Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 1, 2007 Share Posted August 1, 2007 Case solved, or are you still having troubles? If so, please elaborate. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
James Posted August 1, 2007 Author Share Posted August 1, 2007 Ims till having problems. It either shows True or false. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 1, 2007 Share Posted August 1, 2007 What shows True or False? Can you make me a quick reproducer? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] 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