Jump to content

I need help with this IfThen Statement in my gui


Recommended Posts

Can some one help me with this. If so you have my thanks.

Func _1()

If $questA = "combat", then

GUICreate("combat",$GUIWidth,$GUIHeight)

GuiSetState()

EndIf

EndFunc

The problem is that it just says combat in the label;;;;;;;;$questA = IniRead ("questA.ini", "quest", $currentvalue, "error in questa" )

GUICtrlCreateLabel ($questA, 1, 1, 500, 400) ;;;;I had to add that in so you know what I am talking about... If it helps here is everything I have. Well what I have of it.

THE AU3 FILE READS LIKE THIS.....

#include <GUIConstants.au3>

#region - global and variables

;Initialize variables

Global $filemenu

Global $fileitem

Global $recentfilesmenu

Global $separator1

Global $saveitem

Global $exititem

Global $helpmenu

Global $aboutitem

Global $abutton

Global $bbutton

Global $listView

Global $msg

Global $aboutitem

Global $aboutitem

Global $GUIWidth

Global $GUIHeight

$GUIWidth = 700

$GUIHeight = 500

$maxlife = IniRead ( "character.ini", "character", "maxlife", "unknown" )

$life = IniRead ( "character.ini", "character", "life", "unknown" )

$def = IniRead ( "character.ini", "character", "def", "unknown" )

$tohit = IniRead ( "character.ini", "character", "tohit", "unknown" )

$dam = IniRead ( "character.ini", "character", "dam", "unknown" )

#endregion

#Region - GUI Create

#region - main window

GUICreate("GUI menu",$GUIWidth,$GUIHeight)

$filemenu = GuiCtrlCreateMenu ("File")

$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)

$recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu)

$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)

$saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)

$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)

$helpmenu = GuiCtrlCreateMenu ("?")

$aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu)

$abutton = GuiCtrlCreateButton ("a.",50,440,70,20)

$bbutton = GuiCtrlCreateButton ("b.",180,440,70,20)

#endregion

#region - stat view

;colume1

GUICtrlCreateLabel ("Stat", 565, 10, 40, 15)

GUICtrlCreateLabel ("MaxLife", 565, 25, 40, 15)

GUICtrlCreateLabel ("Life", 565, 40, 40, 15)

GUICtrlCreateLabel ("Def", 565, 55, 40, 15)

GUICtrlCreateLabel ("To Hit", 565, 70, 40, 15)

GUICtrlCreateLabel ("Dam", 565, 85, 40, 15)

;columel2

GUICtrlCreateLabel ("Value", 635, 10, 40, 15)

GUICtrlCreateLabel ($MaxLife, 635, 25, 40, 15)

GUICtrlCreateLabel ($Life, 635, 40, 40, 15)

GUICtrlCreateLabel ($Def, 635, 55, 40, 15)

GUICtrlCreateLabel ($ToHit, 635, 70, 40, 15)

GUICtrlCreateLabel ($Dam, 635, 85, 40, 15)

#endregion

GUICtrlCreateLabel ("Wow it works!", 1, 1,500, 400) ; first cell 500 width

GuiSetState()

#endregion

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $fileitem

$file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)")

If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)

Case $msg = $exititem

ExitLoop

Case $msg = $abutton

$newcurrentvalue = IniRead ("counter.ini", "counter", "currentcount", "0" ) + 1

Iniwrite ( "counter.ini", "counter", "currentcount", $newcurrentvalue )

$currentvalue = IniRead ("counter.ini", "counter", "currentcount", "error in current value" )

$questA = IniRead ("questA.ini", "quest", $currentvalue, "error in questa" )

GUICtrlCreateLabel ($questA, 1, 1, 500, 400)

Case $msg = $bbutton

$newcurrentvalue = IniRead ("counter.ini", "counter", "currentcount", "0" ) + 1

Iniwrite ( "counter.ini", "counter", "currentcount", $newcurrentvalue )

$currentvalue = IniRead ("counter.ini", "counter", "currentcount", "error in current value" )

$questB = IniRead ("questB.ini", "quest", $currentvalue, "error in questB" )

GUICtrlCreateLabel ($questB, 1, 1, 500, 450)

Case $msg = $aboutitem

Msgbox(0,"About","GUI Menu Test")

EndSelect

WEnd

GUIDelete()

Exit

#region - functions

Func _1()

If $questA = "combat", then

GUICreate("combat",$GUIWidth,$GUIHeight)

GuiSetState()

EndIf

EndFunc

THE COUNTER INI. FILE READS LIKE THIS......

[counter]

currentcount=0

THE CHARACTER INI. FILE READS LIKE THIS....

[character]

maxlife=20

life=10

def=9

tohit=8

dam=7

THE QUESTA INI. FILE READS LIKE THIS....

[Quest]

1=a1

2=a2

3=combat

4=a4

5=a5

6=a6

7=a7

8=a8

9=a9

10=a10

11=a11

12=a12

13=a13

14=a14

15=a15

16=a16

THE QUESTB INI. FILE READS LIKE THIS.......

[Quest]

1=b1

2=b2

3=b3

4=b4

5=b5

6=b6

7=b7

8=b8

9=b9

10=b10

11=b11

12=b12

13=b13

14=b14

15=b15

16=b16

............

That is all the files I have on this. This is how what I have works, you press the button A or B and it reads from the quest file. The way it knows what line to read is that it stores the number of presses of the A and B buttons to the file named counterIni.

What I am tring to do is to make it launch a new Gui for combat. Using a key word off of the ini files named questA or questB and after the combat( if the player lives) to go back to the first Gui. The key word is combat. Feel free to offer any advice. I am still a newbie, I just found out about AutoIT 3 about there weeks ago and I have no other programming knownledge. I know this project is over my head and I have a lot to learn and a lot more to write , but how else am I going to learn . If you can help me, then you have my thanks. If anyone wants to walk me though this project all the way I will share the credits with you. Every game has to have credits. :lmao:

.

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...