d0pe Posted February 13, 2008 Share Posted February 13, 2008 receive error: Too many Else for If expandcollapse popupWinActivate("") sleep(1000) If Random() < 0.7 Then ; Too many else, to If. How should I do this? :S Send("{m}") Send("{m}") Else Send("{l}") Send("{l}") Else Send("{R}") Send("{Enter}") Else Send("{Space}") Else Send("{I}") Send("{I}") Else Send("{W}") Else Send("{S}") Else Send("{Q}") Else Send("{E}") Else Send("{N}") Send("{N}") Else Send("{l}") Send("{l}") Else Send("{A}") Send("{E}") Else Send("{X}") Else Send("{z}") Else Send("{B}") Send("{B}") Endif Link to comment Share on other sites More sharing options...
weaponx Posted February 13, 2008 Share Posted February 13, 2008 April Fools day came early this year...you can't have multiple "Else" in an If/Else condition. You can have multiple "ElseIf". Link to comment Share on other sites More sharing options...
d0pe Posted February 13, 2008 Author Share Posted February 13, 2008 (edited) Yeah, Im new and I found that out thx anyways. Edited February 13, 2008 by d0pe Link to comment Share on other sites More sharing options...
Valuater Posted February 13, 2008 Share Posted February 13, 2008 (edited) There can only be one "Else" expandcollapse popupWinActivate("") Sleep(1000) $Random = Random(3) If $Random < 0.7 Then ; Too many else, to If. How should I do this? :S Send("{m}") Send("{m}") ElseIf $Random < 0.8 Then Send("{l}") Send("{l}") ElseIf $Random < 0.9 Then Send("{R}") Send("{Enter}") ElseIf $Random < 1.0 Then Send("{Space}") ElseIf $Random < 1.2 Then Send("{I}") Send("{I}") ElseIf $Random < 1.3 Then Send("{W}") ElseIf $Random < 1.4 Then Send("{S}") ElseIf $Random < 1.5 Then Send("{Q}") ElseIf $Random < 1.6 Then Send("{E}") ElseIf $Random < 1.7 Then Send("{N}") Send("{N}") ElseIf $Random < 1.8 Then Send("{l}") Send("{l}") ElseIf $Random < 1.9 Then Send("{A}") Send("{E}") ElseIf $Random < 2.0 Then Send("{X}") ElseIf $Random < 2.1 Then Send("{z}") Else ; there can only be one else Send("{B}") Send("{B}") EndIf 8) .....Too slow.... ... fixed ridiculous code... Edited February 13, 2008 by Valuater Link to comment Share on other sites More sharing options...
weaponx Posted February 13, 2008 Share Posted February 13, 2008 Valuater, calling Random() on every ElseIf defeats the purpose of having a condition at all. I'm not sure what this is doing. Link to comment Share on other sites More sharing options...
Valuater Posted February 13, 2008 Share Posted February 13, 2008 I always try to fix the code the OP has, this one turned into a job.... I guess I should have made my own example in the first place ... fixed lol 8) Link to comment Share on other sites More sharing options...
d0pe Posted February 13, 2008 Author Share Posted February 13, 2008 Thanks mate Link to comment Share on other sites More sharing options...
murdock Posted February 13, 2008 Share Posted February 13, 2008 (edited) I dont know what youre planning with this code, but it looks to me the situation that calls for a Switch(), not a huge If, ElseIf, ElseIf....... WinActivate("") Switch Random() Case 0.1 To 0.7 Send("{m}") Send("{m}") Case 0.7 To 0.9 Send("{l}") Send("{l}") Case 1 To 3 Send("{R}") Send("{Enter}") Case 420 Send("Smoke More") EndSwitch ; etc etc etc Edit: If you want to look into more on the Switch() function, make sure you also look at ContinueCase. The example in that help file is more useful than in the Switch() one. Edited February 13, 2008 by murdock 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