Jump to content

Need Help with Checkbox and Iniwrite.


Recommended Posts

For some reason it is not doing Call(_blocked) in my While 1 select case stament. Please take a look and tell me how to use checkboxs to trigger events such as an Iniwrite. Here is my script.

#include <GuiConstants.au3>
#region Gui
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("Quest Maker", 392, 323,(@DesktopWidth-392)/2, (@DesktopHeight-323)/2 )
$xLabel = GuiCtrlCreateLabel("x", 10, 20, 40, 20)
$xInput = GuiCtrlCreateInput(0, 10, 40, 60, 30)
GUICtrlCreateUpdown($xInput)
$yLabel = GuiCtrlCreateLabel("y", 80, 20, 40, 20)
$yInput = GuiCtrlCreateInput(0, 80, 40, 60, 30)
GUICtrlCreateUpdown($yInput)
$zLabel = GuiCtrlCreateLabel("z", 150, 20, 40, 20)
$zInput = GuiCtrlCreateInput(0, 150, 40, 60, 30)
GUICtrlCreateUpdown($zInput)
GuiCtrlCreateGroup("Coords", -10, 10, 240, 70)
$uCheckbox = GuiCtrlCreateCheckbox("u", 10, 100, 30, 20)
$dCheckbox = GuiCtrlCreateCheckbox("d", 10, 120, 30, 20)
$nCheckbox = GuiCtrlCreateCheckbox("n", 10, 140, 30, 20)
$sCheckbox = GuiCtrlCreateCheckbox("s", 10, 160, 30, 20)
$wCheckbox = GuiCtrlCreateCheckbox("w", 10, 180, 30, 20)
$eCheckbox = GuiCtrlCreateCheckbox("e", 10, 200, 30, 20)
GuiCtrlCreateGroup("Blocked", 0, 90, 50, 130)
$qEdit = GUICtrlCreateEdit("", 0, 220,(@DesktopWidth-410), 35,$WS_HSCROLL)
$wButton = GuiCtrlCreateButton("write", 250, 290, 120, 30)
GuiSetState()
#endregion

#region Funtion
; Start - Functions

Func _writeQuest()
    $x = GUICtrlRead($xInput)
    $y = GUICtrlRead($yInput)
    $z = GUICtrlRead($zInput)
    $q = GUICtrlRead($qedit)
    IniWrite("quest.ini","Quest",($x&","&$y&","&$z),$q)
EndFunc

Func _Blocked()
    
    If $msg = $uCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"u")
    
    ElseIf $msg = $uCheckbox And $dCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"ud")
    ElseIf $msg = $uCheckbox And $nCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"un")
    ElseIf $msg = $uCheckbox And $sCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"us")
    ElseIf $msg = $uCheckbox And $wCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"uw")
    ElseIf $msg = $uCheckbox And $eCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"ue")
    
    
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udn")
    ElseIf $msg = $uCheckbox And $dCheckbox And $sCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"uds")
    ElseIf $msg = $uCheckbox And $dCheckbox And $wCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udw")
    ElseIf $msg = $uCheckbox And $dCheckbox And $eCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"ude")
    
    
    
    
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox And $sCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udns")
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox And $wCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udnw")
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox And $eCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udne")
    
    
    
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox And $sCheckbox And $wCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udnsw")
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox And $sCheckbox And $eCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udnsw")
    
    
    ElseIf $msg = $uCheckbox And $dCheckbox And $nCheckbox And $sCheckbox And $wCheckbox And $eCheckbox Then
    IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"udnswe")
        
    
    
    
    
    
    
    
    
    
    
    
    EndIf
EndFunc

Func _C()
EndFunc

Func _D()
EndFunc

Func _E()
EndFunc

Func _F()
EndFunc

Func _G()
EndFunc

Func _H()
EndFunc

Func _I()
EndFunc

Func _J()
EndFunc
#endregion
#region while 1

While 1
    Global $msg = GUIGetMsg()
    Select
    Case $msg = -3
        Exit
    Case $msg = $wbutton
        call("_writequest")
        Call("_blocked")
    EndSelect
WEnd

I know I have alot more combinations of checkboxs to do but I would like to get it to writeing first before I finish. Maybe I should do a select case statement in my function(I really don't know). Please help

.

Link to comment
Share on other sites

Don't use call to run your function just type _Blocked()

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

I think you'll find that when you call your _Blocked() function, the $Msg variable is equal to the button ($wButton).

You should check the state of every checkbox using GUICtrlRead function instead.

----[ SandyD ]---
Link to comment
Share on other sites

I think you'll find that when you call your _Blocked() function, the $Msg variable is equal to the button ($wButton).

You should check the state of every checkbox using GUICtrlRead function instead.

<{POST_SNAPBACK}>

I did this

Func _Blocked()

$u = GUICtrlRead($uCheckbox)

If $u = 1 Then

IniWrite("quest.ini","Blocked",($x&","&$y&","&$z),"u")

EndIf

EndFunc

And it worked( thank you both) but I had to Gobal $x,$y and $z. I still have not done the others yet though, I'm up so late that it is early now .

Also, what order do I need to write my If stament so that it writes the correct Info to the line? Or should I use some other way all togather.

.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...