Sign in to follow this  
Followers 0
Vindicator209

Variable adding

5 posts in this topic

#1 ·  Posted (edited)

Im not sure this belongs here, but how do you add a number thats already a variable? i have this:

#include <GuiConstants.au3>
Global $Attack1 = 200
Global $AttackMin = 1
Global $ARMOR = 100
GuiCreate("Battle!", 222, 418,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Player 1", 10, 10, 200, 400)
$List_2 = GuiCtrlCreateList("", 20, 30, 180, 110)
$Button_3 = GuiCtrlCreateButton("Load", 20, 150, 180, 20)
$Combo_4 = GuiCtrlCreateCombo("Chest", 20, 180, 180, 21)
$1=GuiCtrlSetData($Combo_4,'Steel Plate')
$Combo_5 = GuiCtrlCreateCombo("Legs", 20, 210, 180, 21)
$2=GuiCtrlSetData($Combo_5,'Steel Plate Legs')
$Combo_6 = GuiCtrlCreateCombo("Weapon", 20, 240, 180, 21)
$3=GuiCtrlSetData($Combo_6,'Crystal Katana')
$Combo_7 = GuiCtrlCreateCombo("Gloves", 20, 270, 180, 21)
$4=GuiCtrlSetData($Combo_7,'Leather Steel-Lined')
$Combo_8 = GuiCtrlCreateCombo("MISC. 1", 20, 300, 180, 21)
$Combo_9 = GuiCtrlCreateCombo("MISC. 2", 20, 330, 180, 21)
$Combo_10 = GuiCtrlCreateCombo("MISC. 3", 20, 360, 180, 21)
$Button_11 = GuiCtrlCreateButton("FIGHT!", 20, 390, 180, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button_11
If GUICtrlRead($Combo_4) = ('Steel Plate') Then
    $ARMOR +10
EndIf
If GUICtrlRead($Combo_5) = ('Steel Plate Legs') Then
                $ARMOR +10  
                EndIf
If GUICtrlRead($Combo_6) = ('Crystal Katana') Then
$Attack1 +10
$AttackMin + 100            
EndIf
If GUICtrlRead($Combo_7) = ('Leather Steel-Lined') Then
                    $ARMOR +5
                    EndIf
If GUICtrlRead($Combo_8) = ('God Jewel') Then
                        EndIf
If GUICtrlRead($Combo_9) = ('God Ring') Then
                            EndIf
If GUICtrlRead($Combo_10) = ('God Amulet') Then
            EndIf
$FIGHT= Random($AttackMin,$Attack1)
$Enemy= Random(50,200)

If $FIGHT < $Enemy Then
    MsgBox(0,"Results", "You Lose!")
    MsgBox(0,"Total", "You Dealt:" $FIGHT "damage" "Your Enemy dealt:" $Enemy "Damage")
EndIf
If $FIGHT > $Enemy Then
    MsgBox(0,"Results", "You Win!")
    MsgBox(0,"Total", "You Dealt:" $FIGHT "damage" "Your Enemy dealt:" $Enemy "Damage")
EndIf
            
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

I bet i have atleast 5 different errors... but i cant figure out how to add a numbr to a variable that already is a number...

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



for example:

$var += 1
oh ok.. thanks

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Also, for slightly different readability one can do a

$var = $var + 1
it's also a slower method

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0