Sign in to follow this  
Followers 0
Vindicator209

Cant Edit data?

5 posts in this topic

Ok, Ive got this game, and it wont close, no matter what I try to do to it, can anyone help me?

#include <GuiConstants.au3>

GuiCreate("Battle V3", 708, 412,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Money=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money")
$God=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "GOD")
$name=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Name")
$health=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP")
If $God="1" Then
$health= 99999
EndIf
$1s=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell1")
$2s=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell2")
$3s=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell3")
$msp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "msp")
$dsp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "dsp")
Global $Spell=20
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "DEAD")
$Edit_1 = GuiCtrlCreateEdit("Welcome back to BATTLE," & $name & ", Have Fun!", 10, 10, 690, 200,$ES_READONLY)
$Input_2 = GuiCtrlCreateInput($health, 60, 230, 130, 20,$ES_READONLY)
$Input_3 = GuiCtrlCreateInput($Money, 60, 250, 130, 20,$ES_READONLY)
$Label_4 = GuiCtrlCreateLabel("Health", 20, 230, 50, 20)
$Label_5 = GuiCtrlCreateLabel("Money", 20, 250, 40, 20)
$Button_6 = GuiCtrlCreateButton("Attack", 200, 230, 80, 20)
$Button_7 = GuiCtrlCreateButton("Yes", 200, 250, 40, 20)
$Button_8 = GuiCtrlCreateButton("No", 240, 250, 40, 20)
$Button_9 = GuiCtrlCreateButton("Save", 300, 230, 60, 20)
$Button_10 = GuiCtrlCreateButton("Load", 300, 270, 60, 20)
$Button_11 = GuiCtrlCreateButton("Reset", 300, 250, 60, 20)
$Group_12 = GuiCtrlCreateGroup("Status", 10, 210, 280, 90)
$Group_13 = GuiCtrlCreateGroup("File Options", 290, 210, 80, 90)
$Button_14 = GuiCtrlCreateButton("Action", 200, 270, 80, 20)
$Label_15 = GuiCtrlCreateLabel("Move", 20, 270, 40, 20)
$Input_16 = GuiCtrlCreateInput("Direction", 60, 270, 130, 20)
$Group_17 = GuiCtrlCreateGroup("Spells", 10, 310, 360, 90)
$Button_18 = GuiCtrlCreateButton("Hell Fire", 20, 330, 90, 40)
$Button_19 = GuiCtrlCreateButton("Ice Nova", 130, 330, 100, 40)
$Button_20 = GuiCtrlCreateButton("Torrent", 260, 330, 90, 40)
$Input_21 = GuiCtrlCreateInput($1s, 20, 370, 90, 20,$ES_READONLY)
$Input_22 = GuiCtrlCreateInput($2s, 130, 370, 100, 20,$ES_READONLY)
$Input_23 = GuiCtrlCreateInput($3s, 260, 370, 90, 20,$ES_READONLY)
$Group_24 = GuiCtrlCreateGroup("Stat Points", 380, 210, 180, 90)
$Button_25 = GuiCtrlCreateButton("+", 110, 370, 10, 20)
$Button_26 = GuiCtrlCreateButton("+", 230, 370, 10, 20)
$Button_27 = GuiCtrlCreateButton("+", 350, 370, 10, 20)
$Input_28 = GuiCtrlCreateInput($msp, 450, 230, 100, 20,$ES_READONLY)
$Label_29 = GuiCtrlCreateLabel("Magic SP", 390, 230, 50, 20)
$Label_30 = GuiCtrlCreateLabel("Durability SP", 390, 260, 50, 30)
$Input_31 = GuiCtrlCreateInput($dsp, 450, 260, 80, 20,$ES_READONLY)
$Button_32 = GuiCtrlCreateButton("+", 530, 260, 21, 20)
$Group_33 = GuiCtrlCreateGroup("Items", 380, 310, 320, 90)
$List_34 = GuiCtrlCreateList("", 390, 330, 140, 45)
$List_35 = GuiCtrlCreateList("", 550, 330, 140, 45)
$Button_36 = GuiCtrlCreateButton("Use/Equip/Wear", 390, 380, 300, 20)
$Group_37 = GuiCtrlCreateGroup("?????", 560, 210, 140, 90)
$Button_38 = GuiCtrlCreateButton("", 570, 230, 120, 60)
    If $name="" Then
        MsgBox(0,"New Game","Hello, it must be your first time playing!")
                MsgBox(0,"New Game","I will guide you through the game.")
                        MsgBox(0,"New Game","First off, what is your name?")
                        $NAME2=InputBox("You Name:","Enter your character's Name:",""," ","-1","-1","-1","-1")
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Name","REG_SZ",$NAME2)
                                MsgBox(0,"New Game","OK!, I have saved your name!")
                                        MsgBox(0,"New Game","As you prgress, you gain stat points, which  can be used to raise HP, or some, to Level up SPELLS")
        MsgBox(0,"New Game","The points can be used by pressing the given '+' buttons")
        MsgBox(0,"New Game","The rest SHOULD be self explanitory, if not, consult the forum")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money","REG_SZ","100")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ","50")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell1","REG_SZ","1")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell2","REG_SZ","1")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell3","REG_SZ","1")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "msp","REG_SZ","2")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "dsp","REG_SZ","1")
        Exit
    EndIf
GuiSetState()
$234=1
While $234
            If GUICtrlRead($Input_31) > 0 Then
            $dsp= $dsp -1
            GUICtrlSetData($Input_31,$msp)
            $health= $health + 5
            GUICtrlSetData($Input_2,$health)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ",$health)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "dsp","REG_SZ",$msp)
            If $health>5 Then
                $234=0
            EndIf
            EndIf
WEnd
        
        While 1
If $health<1 Then
    If Not RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "DEAD") = '1' Then
    MsgBox(0,"You Died!","Oh Oh! You Died!")
    Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(52,"DEAD!","So you died, would you like to continue at your last save point?" & @CRLF & "If you have ENOUGH durability points, you may click OK and restart the game to heal yourself")
Select
   Case $iMsgBoxAnswer = 6 ;Yes
Exit
   Case $iMsgBoxAnswer = 7 ;No
       RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "DEAD","REG_SZ",'1')
EndSelect
EndIf
EndIf
Global $msg = GuiGetMsg()
$Money=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money")
$God=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "GOD")
$name=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Name")
$health=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP")
$1s=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell1")
$2s=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell2")
$3s=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell3")
$msp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "msp")
$dsp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "dsp")
Global $msg = GuiGetMsg()
    Select
    Case $msg = $Button_38
        Run("CDAT.EXE")
    Case $msg = $Button_25
        If GUICtrlRead($Input_28) > 0 Then
            $msp= $msp -1
            GUICtrlSetData($Input_28,$msp)
            $1s= $1s + 1
            GUICtrlSetData($Input_21,$1s)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell1","REG_SZ",$1s)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "msp","REG_SZ",$msp)
        Else
            MsgBox(0,"Error","Not Enought Magic Points")
        EndIf
    Case $msg = $Button_26
        If GUICtrlRead($Input_28) > 0 Then
            $msp= $msp -1
            GUICtrlSetData($Input_28,$msp)
            $2s= $2s + 1
            GUICtrlSetData($Input_22,$2s)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell2","REG_SZ",$2s)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "msp","REG_SZ",$msp)
        Else
            MsgBox(0,"Error","Not Enought Magic Points")
        EndIf
    Case $msg = $Button_27
                If GUICtrlRead($Input_28) > 0 Then
            $msp= $msp -1
            GUICtrlSetData($Input_28,$msp)
            $3s= $3s + 1
            GUICtrlSetData($Input_23,$3s)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Spell3","REG_SZ",$3s)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "msp","REG_SZ",$msp)
        Else
            MsgBox(0,"Error","Not Enought Magic Points")
        EndIf
    Case $msg = $Button_32
            If GUICtrlRead($Input_31) > 0 Then
            $dsp= $dsp -1
            GUICtrlSetData($Input_31,$dsp)
            $health= $health + 5
            GUICtrlSetData($Input_2,$health)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ",$health)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "dsp","REG_SZ",$msp)
        Else
            MsgBox(0,"Error","Not Enought Durability Points")
        EndIf
    Case $msg = $Button_6
        $monsterhp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Monster")
        $monsterhp=Random(20,100,1)
        $playerAttack=Random(5,100,1)
        $monsterhp= $monsterhp - $playerAttack
        $monsterAttack= Random(10,30,1)
        $health= $health - $monsterAttack
        If $monsterhp<5 Then
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Hit:' & $playerAttack &' ,You Win!')
        Else
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Hit:' & $playerAttack &' ,The Monster had:' & $monsterhp & ' HP left! It ran away.')
    EndIf
                $health= $health - $monsterAttack
            GUICtrlSetData($Input_2,$health)
        If Not $health < 1 Then
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ",$health)
    EndIf
Case $msg = $Button_18
    $spelltax= $1s * 3 + 10
    $spelltotal= $spelltax * 5
        $monsterhp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Monster")
        $monsterhp=Random(20,100,1)
        $playerAttackspell=Random($spelltax,$spelltotal,1)
        $monsterhp= $monsterhp - $playerAttackspell
        $monsterAttack= Random(10,30,1)
        $health= $health - $monsterAttack
        $Cash=Random(100,700,1)
        If $monsterhp<5 Then
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Casted Hell Fire LVL' & $1s &'and hit '& $playerAttackspell &' ,You Win!')
                    $Money= $Money + $Cash
            GUICtrlSetData($Input_3,$Money)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money","REG_SZ",$Money)
        Else
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Casted Hell Fire LVL' & $1s &'and hit ' & $playerAttackspell &' ,The Monster had:' & $monsterhp & ' HP left! It ran away.')
    EndIf
                $health= $health - $monsterAttack
            GUICtrlSetData($Input_2,$health)
        If Not $health < 1 Then
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ",$health)
    EndIf
Case $msg = $Button_19
    $spelltax= $2s * 3 + 10
    $spelltotal= $spelltax * 5
        $monsterhp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Monster")
        $monsterhp=Random(20,100,1)
        $playerAttackspell=Random($spelltax,$spelltotal,1)
        $monsterhp= $monsterhp - $playerAttackspell
        $monsterAttack= Random(10,30,1)
        $health= $health - $monsterAttack
        $Cash=Random(100,700,1)
        If $monsterhp<5 Then
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Casted Ice Nova LVL' & $2s &'and hit '& $playerAttackspell &' ,You Win!')
            $Money= $Money + $Cash
            GUICtrlSetData($Input_3,$Money)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money","REG_SZ",$Money)
        Else
            $losewin=Random(1,10)
            If $losewin <10 Then
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Casted Ice Nova LVL' & $2s &'and hit ' & $playerAttackspell &' ,The Monster has:' & $monsterhp & ' HP left! It is FROZEN')
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Attacked and Hit' & $playerAttackspell &' You Win!')
                    $Money= $Money + $Cash
            GUICtrlSetData($Input_3,$Money)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money","REG_SZ",$Money)
        Else
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'The Monster ran away')
            EndIf
    EndIf
                $health= $health - $monsterAttack
            GUICtrlSetData($Input_2,$health)
        If Not $health < 1 Then
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ",$health)
    EndIf
    Case $msg = $Button_20
    $spelltax= $1s * 3 + 10
    $spelltotal= $spelltax * 5
        $monsterhp=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Monster")
        $monsterhp=Random(20,100,1)
        $playerAttackspell=Random($spelltax,$spelltotal,1)
        $monsterhp= $monsterhp - $playerAttackspell
        $monsterAttack= Random(10,30,1)
        $health= $health - $monsterAttack
        $Cash=Random(100,700,1)
        If $monsterhp<5 Then
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Casted Torrent LVL' & $1s &'and hit '& $playerAttackspell &' ,You Win!')
                    $Money= $Money + $Cash
            GUICtrlSetData($Input_3,$Money)
            RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "Money","REG_SZ",$Money)
        Else
        GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & @CRLF &'You Torrent Fire LVL' & $1s &'and hit ' & $playerAttackspell &' ,The Monster had:' & $monsterhp & ' HP left! It ran away.')
    EndIf
                $health= $health - $monsterAttack
            GUICtrlSetData($Input_2,$health)
        If Not $health < 1 Then
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\BATTLEV3\Game", "HP","REG_SZ",$health)
    EndIf
    
    Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    
    Case Else
        ;;;
    EndSelect
WEnd
Exit

ok, so heres my problem, I have a little cheat for my game, but i cant edit the $health variable

If $God="1" Then
$health= 99999
EndIf

Why is this? P.S. i cant get this code to close either, I have to right click on the AU3 icon...


[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 the close add this:

Case $msg = $GUI_EVENT_CLOSE
Exit

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

it doesnt work,

also, how can I make the read only edit box to have a scroll bar on the right? because then there are too many things in the box, it just leaves the box, and doesnt show up

PS, got any idea why the script is so slow? too many loops?

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

$Edit_1 = GuiCtrlCreateEdit("Welcome back to BATTLE," & $name & ", Have Fun!", 10, 10, 690, 200, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSendMsg($Edit_1, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($Edit_1, 0xFFFFFF)


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

am i allowed to guess thats for a scroll bar? if so, 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

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