Chobby Posted April 17, 2006 Share Posted April 17, 2006 I'm experiencing a problem (look in topic description), and i cant get by it ... :S Here's my code... I know that the "Send" button isn't active .. I'm not that far in the scripting yet As for now i just need it to send it to the "Preview" Thanks expandcollapse popup; Script Start #include <GUIConstants.au3> GUICreate("Ca Server Commands - By Chobby - v.0.1", 440, 540, 100, 100) GUISetState (@SW_SHOW) GUICtrlCreateLabel("Misc. server commands controlpad If AM Admin", 10, 10, 350) GUICtrlCreateGroup("Change Map:", 10, 30, 420, 205) GUICtrlCreateGroup("Choose Map:", 20, 45, 240, 160) $mapffa_bespin = GUICtrlCreateRadio("FFA_Bespin", 30, 60, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $mapffa_deathstar = GUICtrlCreateRadio("FFA_Deathstar", 30, 80, 100, 20) $mapffa_imperial = GUICtrlCreateRadio("FFA_Imperial", 30, 100, 100, 20) $mapffa_ns_hideout = GUICtrlCreateRadio("FFA_NS_Hideout", 30, 120, 100, 20) $mapffa_ns_streets = GUICtrlCreateRadio("FFA_NS_Streets", 30, 140, 100, 20) $mapffa_raven = GUICtrlCreateRadio("FFA_Raven", 30, 160, 100, 20) $mapffa_yavin = GUICtrlCreateRadio("FFA_Yavin", 30, 180, 100, 20) $mapctf_bespin = GUICtrlCreateRadio("CTF_Bespin", 150, 60, 100, 20) $mapctf_imperial = GUICtrlCreateRadio("CTF_Imperial", 150, 80, 100, 20) $mapctf_ns_streets = GUICtrlCreateRadio("CTF_NS_Streets", 150, 100, 100, 20) $mapctf_yavin = GUICtrlCreateRadio("CTF_Yavin", 150, 120, 100, 20) $mapduel_bay = GUICtrlCreateRadio("Duel_Bay", 150, 140, 100, 20) $mapduel_jedi = GUICtrlCreateRadio("Duel_Jedi", 150, 160, 100, 20) $mapduel_pit = GUICtrlCreateRadio("Duel_Pit", 150, 180, 100, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Choose Gametype:", 270, 45, 150, 160) $typeffa = GUICtrlCreateRadio("Free For All", 280, 60, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $typeholo = GUICtrlCreateRadio("Holocron", 280, 80, 100, 20) $typejedi = GUICtrlCreateRadio("Jedimaster", 280, 100, 100, 20) $typeduel = GUICtrlCreateRadio("Duel", 280, 120, 100, 20) $typetffa = GUICtrlCreateRadio("Team Free For All", 280, 140, 100, 20) $typectf = GUICtrlCreateRadio("Capture The Flag", 280, 160, 100, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) $BTNPreview = GUICtrlCreateButton("&Preview", 20, 210, 100, 20) GUICtrlSetTip(-1, "Show the options") $BTNSend = GUICtrlCreateButton("&Send", 125, 210, 100, 20) GUICtrlSetTip(-1, "Switch Map") $BTNExit = GUICtrlCreateButton("&Exit", 230, 210, 100, 20) GUICtrlSetTip(-1, "Exit the program") GUICtrlCreateGroup("", -99, -99, 1, 1) While $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $BTNExit Exit Case $msg = $BTNPreview MsgBox(_SetFlag($iFlag)) WEnd ; _SetFlag Func. Func _SetFlag($iFlag) $iFlag = 0 ;Map Select Case GUICtrlRead($mapffa_bespin) = $GUI_CHECKED $iFlag = $iFlag + 8 Case GUICtrlRead($mapffa_deathstar) = $GUI_CHECKED $iFlag = $iFlag + 16 Case GUICtrlRead($mapffa_imperial) = $GUI_CHECKED $iFlag = $iFlag + 32 Case GUICtrlRead($mapffa_ns_hideout) = $GUI_CHECKED $iFlag = $iFlag + 64 Case GUICtrlRead($mapffa_ns_streets) = $GUI_CHECKED $iFlag = $iFlag + 128 Case GUICtrlRead($mapffa_raven) = $GUI_CHECKED $iFlag = $iFlag + 256 Case GUICtrlRead($mapffa_yavin) = $GUI_CHECKED $iFlag = $iFlag + 512 Case GUICtrlRead($mapctf_bespin) = $GUI_CHECKED $iFlag = $iFlag + 1024 Case GUICtrlRead($mapctf_imperial) = $GUI_CHECKED $iFlag = $iFlag + 2048 Case GUICtrlRead($mapctf_ns_streets) = $GUI_CHECKED $iFlag = $iFlag + 4096 Case GUICtrlRead($mapctf_yavin) = $GUI_CHECKED $iFlag = $iFlag + 8192 Case GUICtrlRead($mapduel_bay) = $GUI_CHECKED $iFlag = $iFlag + 16384 Case GUICtrlRead($mapduel_jedi) = $GUI_CHECKED $iFlag = $iFlag + 32768 Case GUICtrlRead($mapduel_pit) = $GUI_CHECKED EndSelect ;Gametype Select Case GUICtrlRead($typeffa) = $GUI_CHECKED $iFlag = $iFlag + 65536 Case GUICtrlRead($typeholo) = $GUI_CHECKED $iFlag = $iFlag + 131072 Case GUICtrlRead($typejedi) = $GUI_CHECKED $iFlag = $iFlag + 262144 Case GUICtrlRead($typeduel) = $GUI_CHECKED $iFlag = $iFlag + 524288 Case GUICtrlRead($typetffa) = $GUI_CHECKED $iFlag = $iFlag + 1048576 Case GUICtrlRead($typectf) = $GUI_CHECKED $iFlag = $iFlag + 2097152 EndSelect Return $iFlag EndFunc ;==>_SetFlag Link to comment Share on other sites More sharing options...
CyberSlug Posted April 17, 2006 Share Posted April 17, 2006 You are missing EndSelectIt should go right above WEnd Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
herewasplato Posted April 17, 2006 Share Posted April 17, 2006 Are you using the SciTE editor? Here is the output of the syntax check:>Running AU3Check params: from:C:\Program Files\AutoIt3\SciTE\au3check\ c:\Temp\SciTE-temp.au3(43,6) : ERROR: syntax error While ~~~~~^ c:\Temp\SciTE-temp.au3(50,34) : WARNING: $iFlag: possibly used before declaration. MsgBox(_SetFlag($iFlag) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ c:\Temp\SciTE-temp.au3(50,35) : ERROR: MsgBox() [built-in]called with wrong number of args. MsgBox(_SetFlag($iFlag)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ c:\Temp\SciTE-temp.au3(51,1) : ERROR: missing EndSelect. WEnd ^ c:\Temp\SciTE-temp.au3(45,11) : REF: missing EndSelect. Select ~~~~~~~~~~^ c:\Temp\SciTE-temp.au3(50,34) : ERROR: $iFlag: undeclared global variable. MsgBox(_SetFlag($iFlag) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ c:\Temp\SciTE-temp.au3 - 4 error(s), 1 warning(s)Maybe you meant While 1 [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Chobby Posted April 17, 2006 Author Share Posted April 17, 2006 @ CyberSlug Yup .. That was the problem .. Thanks for the fast reply @ herewasplato Nope, im not .. Good ol' notepad.. Thanks for the fast reply as well.. Link to comment Share on other sites More sharing options...
CyberSlug Posted April 17, 2006 Share Posted April 17, 2006 Notepad is very limited. We recommend other text editors (especially SciTE). Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Valuater Posted April 17, 2006 Share Posted April 17, 2006 (edited) Notepad is very limited. We recommend other text editors (especially SciTE).i agree... andto get SciTE, Beta and learn alot quickly... see thishttp://www.autoitscript.com/forum/index.php?showtopic=21048#8) Edited April 17, 2006 by Valuater Link to comment Share on other sites More sharing options...
Chobby Posted April 17, 2006 Author Share Posted April 17, 2006 Okay .. Thanks guys, ill be using SciTe from now on Well, i just have some major problems, that i dont know how to figure out.. Well, i got my script: expandcollapse popup; Script Start #include <GUIConstants.au3> GUICreate("Ca Server Commands - By Chobby - v.0.1", 440, 540, 100, 100) GUISetState (@SW_SHOW) GUICtrlCreateLabel("Misc. server commands controlpad If AM Admin", 10, 10, 350) GUICtrlCreateGroup("Change Map:", 10, 30, 420, 205) GUICtrlCreateGroup("Choose Map:", 20, 45, 240, 160) $mapffa_bespin = GUICtrlCreateRadio("FFA_Bespin", 30, 60, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $mapffa_deathstar = GUICtrlCreateRadio("FFA_Deathstar", 30, 80, 100, 20) $mapffa_imperial = GUICtrlCreateRadio("FFA_Imperial", 30, 100, 100, 20) $mapffa_ns_hideout = GUICtrlCreateRadio("FFA_NS_Hideout", 30, 120, 100, 20) $mapffa_ns_streets = GUICtrlCreateRadio("FFA_NS_Streets", 30, 140, 100, 20) $mapffa_raven = GUICtrlCreateRadio("FFA_Raven", 30, 160, 100, 20) $mapffa_yavin = GUICtrlCreateRadio("FFA_Yavin", 30, 180, 100, 20) $mapctf_bespin = GUICtrlCreateRadio("CTF_Bespin", 150, 60, 100, 20) $mapctf_imperial = GUICtrlCreateRadio("CTF_Imperial", 150, 80, 100, 20) $mapctf_ns_streets = GUICtrlCreateRadio("CTF_NS_Streets", 150, 100, 100, 20) $mapctf_yavin = GUICtrlCreateRadio("CTF_Yavin", 150, 120, 100, 20) $mapduel_bay = GUICtrlCreateRadio("Duel_Bay", 150, 140, 100, 20) $mapduel_jedi = GUICtrlCreateRadio("Duel_Jedi", 150, 160, 100, 20) $mapduel_pit = GUICtrlCreateRadio("Duel_Pit", 150, 180, 100, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Choose Gametype:", 270, 45, 150, 160) $typeffa = GUICtrlCreateRadio("Free For All", 280, 60, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $typeholo = GUICtrlCreateRadio("Holocron", 280, 80, 100, 20) $typejedi = GUICtrlCreateRadio("Jedimaster", 280, 100, 100, 20) $typeduel = GUICtrlCreateRadio("Duel", 280, 120, 100, 20) $typetffa = GUICtrlCreateRadio("Team Free For All", 280, 140, 100, 20) $typectf = GUICtrlCreateRadio("Capture The Flag", 280, 160, 100, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) $BTNPreview = GUICtrlCreateButton("&Preview", 20, 210, 100, 20) GUICtrlSetTip(-1, "Show the options") $BTNSend = GUICtrlCreateButton("&Send", 125, 210, 100, 20) GUICtrlSetTip(-1, "Switch Map") $BTNExit = GUICtrlCreateButton("&Exit", 230, 210, 100, 20) GUICtrlSetTip(-1, "Exit the program") GUICtrlCreateGroup("", -99, -99, 1, 1) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $BTNExit Exit Case $msg = $BTNPreview MsgBox(_SetFlag($iFlag)) EndSelect WEnd ; _SetFlag Func. Func _SetFlag($iFlag) $iFlag = 0 ;Map Select Case GUICtrlRead($mapffa_bespin) = $GUI_CHECKED $iFlag = $iFlag + 8 Case GUICtrlRead($mapffa_deathstar) = $GUI_CHECKED $iFlag = $iFlag + 16 Case GUICtrlRead($mapffa_imperial) = $GUI_CHECKED $iFlag = $iFlag + 32 Case GUICtrlRead($mapffa_ns_hideout) = $GUI_CHECKED $iFlag = $iFlag + 64 Case GUICtrlRead($mapffa_ns_streets) = $GUI_CHECKED $iFlag = $iFlag + 128 Case GUICtrlRead($mapffa_raven) = $GUI_CHECKED $iFlag = $iFlag + 256 Case GUICtrlRead($mapffa_yavin) = $GUI_CHECKED $iFlag = $iFlag + 512 Case GUICtrlRead($mapctf_bespin) = $GUI_CHECKED $iFlag = $iFlag + 1024 Case GUICtrlRead($mapctf_imperial) = $GUI_CHECKED $iFlag = $iFlag + 2048 Case GUICtrlRead($mapctf_ns_streets) = $GUI_CHECKED $iFlag = $iFlag + 4096 Case GUICtrlRead($mapctf_yavin) = $GUI_CHECKED $iFlag = $iFlag + 8192 Case GUICtrlRead($mapduel_bay) = $GUI_CHECKED $iFlag = $iFlag + 16384 Case GUICtrlRead($mapduel_jedi) = $GUI_CHECKED $iFlag = $iFlag + 32768 Case GUICtrlRead($mapduel_pit) = $GUI_CHECKED EndSelect ;Gametype Select Case GUICtrlRead($typeffa) = $GUI_CHECKED $iFlag = $iFlag + 65536 Case GUICtrlRead($typeholo) = $GUI_CHECKED $iFlag = $iFlag + 131072 Case GUICtrlRead($typejedi) = $GUI_CHECKED $iFlag = $iFlag + 262144 Case GUICtrlRead($typeduel) = $GUI_CHECKED $iFlag = $iFlag + 524288 Case GUICtrlRead($typetffa) = $GUI_CHECKED $iFlag = $iFlag + 1048576 Case GUICtrlRead($typectf) = $GUI_CHECKED $iFlag = $iFlag + 2097152 EndSelect Return $iFlag EndFunc ;==>_SetFlag And it works, kinda fine.. But can any of you give an example on how to get 2 "selections" chosen and showed in a MsgBox? If you would be so kind..? Link to comment Share on other sites More sharing options...
herewasplato Posted April 18, 2006 Share Posted April 18, 2006 ...But can any of you give an example on how to get 2 "selections" chosen and showed in a MsgBox?...You want two radio buttons selceted at the same time within a given area, correct?I don't know how to do that, but maybe my restating the problem (and giving the request a bump in the forum) might help... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2006 Share Posted April 18, 2006 (edited) CODE; _SetFlag Func. Func _SetFlag($iFlag) $iFlag = 0 ;Map Select Case GUICtrlRead($mapffa_bespin) = $GUI_CHECKED $iFlag = $iFlag + 8 Case GUICtrlRead($mapffa_deathstar) = $GUI_CHECKED $iFlag = $iFlag + 16 Case GUICtrlRead($mapffa_imperial) = $GUI_CHECKED $iFlag = $iFlag + 32 Case GUICtrlRead($mapffa_ns_hideout) = $GUI_CHECKED $iFlag = $iFlag + 64 Case GUICtrlRead($mapffa_ns_streets) = $GUI_CHECKED $iFlag = $iFlag + 128 Case GUICtrlRead($mapffa_raven) = $GUI_CHECKED $iFlag = $iFlag + 256 Case GUICtrlRead($mapffa_yavin) = $GUI_CHECKED $iFlag = $iFlag + 512 Case GUICtrlRead($mapctf_bespin) = $GUI_CHECKED $iFlag = $iFlag + 1024 Case GUICtrlRead($mapctf_imperial) = $GUI_CHECKED $iFlag = $iFlag + 2048 Case GUICtrlRead($mapctf_ns_streets) = $GUI_CHECKED $iFlag = $iFlag + 4096 Case GUICtrlRead($mapctf_yavin) = $GUI_CHECKED $iFlag = $iFlag + 8192 Case GUICtrlRead($mapduel_bay) = $GUI_CHECKED $iFlag = $iFlag + 16384 Case GUICtrlRead($mapduel_jedi) = $GUI_CHECKED $iFlag = $iFlag + 32768 Case GUICtrlRead($mapduel_pit) = $GUI_CHECKED EndSelect ;Gametype Select Case GUICtrlRead($typeffa) = $GUI_CHECKED $iFlag = $iFlag + 65536 Case GUICtrlRead($typeholo) = $GUI_CHECKED $iFlag = $iFlag + 131072 Case GUICtrlRead($typejedi) = $GUI_CHECKED $iFlag = $iFlag + 262144 Case GUICtrlRead($typeduel) = $GUI_CHECKED $iFlag = $iFlag + 524288 Case GUICtrlRead($typetffa) = $GUI_CHECKED $iFlag = $iFlag + 1048576 Case GUICtrlRead($typectf) = $GUI_CHECKED $iFlag = $iFlag + 2097152 EndSelect Return $iFlag EndFunc;==>_SetFlag And it works, kinda fine.. But can any of you give an example on how to get 2 "selections" chosen and showed in a MsgBox? If you would be so kind..? If I understand your _SetFlag() function correctly, you need to use a bunch of IF statements instead of CASE. Once you get a match in CASE, the rest of the cases will not be checked, so you don't get the sum of the checked values. Try it like this: ; _SetFlag Func. Func _SetFlag() Local $iFlag = 0 ; Map If GUICtrlRead($mapffa_bespin) = $GUI_CHECKED Then $iFlag = $iFlag + 8 If GUICtrlRead($mapffa_deathstar) = $GUI_CHECKED Then $iFlag = $iFlag + 16 If GUICtrlRead($mapffa_imperial) = $GUI_CHECKED Then $iFlag = $iFlag + 32 If GUICtrlRead($mapffa_ns_hideout) = $GUI_CHECKED Then $iFlag = $iFlag + 64 If GUICtrlRead($mapffa_ns_streets) = $GUI_CHECKED Then $iFlag = $iFlag + 128 If GUICtrlRead($mapffa_raven) = $GUI_CHECKED Then $iFlag = $iFlag + 256 If GUICtrlRead($mapffa_yavin) = $GUI_CHECKED Then $iFlag = $iFlag + 512 If GUICtrlRead($mapctf_bespin) = $GUI_CHECKED Then $iFlag = $iFlag + 1024 If GUICtrlRead($mapctf_imperial) = $GUI_CHECKED Then $iFlag = $iFlag + 2048 If GUICtrlRead($mapctf_ns_streets) = $GUI_CHECKED Then $iFlag = $iFlag + 4096 If GUICtrlRead($mapctf_yavin) = $GUI_CHECKED Then $iFlag = $iFlag + 8192 If GUICtrlRead($mapduel_bay) = $GUI_CHECKED Then $iFlag = $iFlag + 16384 If GUICtrlRead($mapduel_jedi) = $GUI_CHECKED Then $iFlag = $iFlag + 32768 If GUICtrlRead($mapduel_pit) = $GUI_CHECKED Then ;Gametype If GUICtrlRead($typeffa) = $GUI_CHECKED Then $iFlag = $iFlag + 65536 If GUICtrlRead($typeholo) = $GUI_CHECKED Then $iFlag = $iFlag + 131072 If GUICtrlRead($typejedi) = $GUI_CHECKED Then $iFlag = $iFlag + 262144 If GUICtrlRead($typeduel) = $GUI_CHECKED Then $iFlag = $iFlag + 524288 If GUICtrlRead($typetffa) = $GUI_CHECKED Then $iFlag = $iFlag + 1048576 If GUICtrlRead($typectf) = $GUI_CHECKED Then $iFlag = $iFlag + 2097152 EndIf Return $iFlag EndFunc ;==>_SetFlag Note that you don't have to pass $iFlag to the function, since you set it to zero every time anyway. Edited April 18, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
CyberSlug Posted April 18, 2006 Share Posted April 18, 2006 It's too bad you aren't using an array for the controls. Otherwise, you could shorten the code to something like this:;Assume $ctrlArray has $n elements Func _SetFlag() Local $iFlag = 0, $i For $i = 0 to $n-1 If GUICtrlRead($ctrlArray[$i]) = $GUI_CHECKED Then $iFlag = $iFlag + 2 ^ ($i+3) Next Return $iFlag EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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