Jump to content

ControlMoving the wrong thing?


Go to solution Solved by gottygolly,

Recommended Posts

I started to make this just for fun and for some reason on line 103 (ControlMove($gui,"",$obj,10,-50)) it moves the button with the variable ($5_button) if i comment out the button it then moves the bank part if I comment out the bank part then it moves the health part, I can't figure this out and it's driving me insane because it doesn't make any sense.

Please help me, a simple explanation would be perfect I can fix the code myself if you don't feel like doing so.

#include<guiconstants.au3>
Global $obj,$prog,$turret,$damage,$prog_b,$turrent,$turret_range
Opt("GUIOnEventMode",1)
;Opt("GUICoordMode",1)
$gui = GUICreate("Box TowerDefense",@desktopwidth-500,@desktopheight-500,-1,-1)
$bal = 250
$bank = GUICtrlCreateLabel("Bank: $"&$bal,500,5,150,30)
$lives = 100
$live = GUICtrlCreateLabel("Health: "&$lives&"/100",500,25,150,30)
npc()
Local $s_lastsec = @SEC,$b_la = @SEC
$5_damage = GUICtrlCreateButton("Upgrade Damage +1 [$250]",500,100,150,30)
GUICtrlSetOnEvent($5_damage,"damage_upg")
$i = 0
$t = 0
$dead = False
$damage = 1
GUISetOnEvent(-3,"_Exit")
$round = 10
GUISetState()
While 1
   $b = @SEC
   movement()
   damage()
   death()
   If $b <> $b_la Then
      GUICtrlSetState($turret_range,$gui_hide)
   rangecheck()
   $b_la = $b
   EndIf
WEnd

Func damage_upg()
   ;#cs
   If $bal - 250 * $damage >= 0 Then
            $bal = $bal - 250 * $damage
            GUICtrlSetData($bank,"Bank: $"&$bal)
         $damage = $damage + 1
      Else
         MsgBox(0,"Error","Insufficient Funds")
      EndIf
    ;  #ce
    EndFunc
    Func damage()
      $cp = ControlGetPos($gui,"",$obj)
      $cp_turret = ControlGetPos($gui,"",$turret)
      $cp_range = ControlGetPos($gui,"",$turret_range)
      $t += 1
      $hp_change = $round * 2/5
      If $cp[0] + $cp[2] >= $cp_range[0] And $cp[1] >= $cp_range[1] And $cp[0] <= $cp_range[0]+$cp_range[2] And $cp[1] <= $cp_range[1]+$cp_range[3] And $t >= $hp_change Then
            $cp_hp = ControlGetPos($gui,"",$prog)
            $new_hp = $cp_hp[0] - $damage
            ;GUICtrlSetData($prog,$new_hp)
            ControlMove($gui,"",$prog,$cp_hp[0],$cp_hp[1],$cp_hp[2]-$damage)
            ;ControlMove($gui,"",$prog_b,$cp_hp[0],$cp_hp[1],$cp_hp[2],$cp_hp[3])

            $t = 0
            EndIf
   EndFunc

Func npc()
   $turret_range = GUICtrlCreateGroup("",50,-40,250,240)
   GUICtrlSetState($turret_range,$gui_hide)
   $obj = GUICtrlCreateInput("",10,0,50,50)
   $turret = GUICtrlCreateInput("",150,50,50,50)
   GUICtrlSetState($turret_range,128)
   GUICtrlSetState($turret,$gui_disable)
   GUICtrlSetBkColor($turret,0x0000FF)
GUICtrlSetState($obj,$gui_disable)
$prog = GUICtrlCreateButton("",0,-20,75,13)
GUICtrlSetBkColor($prog,0x00A000)
GUICtrlSetState($prog,$gui_disable)
GUICtrlSetBkColor($obj,0x000000)
Sleep(10)
EndFunc

Func movement()
   $s = @SEC
   If $s <> $s_lastsec Then
      $i += 1
      $cp = ControlGetPos($gui,"",$obj)
      $cp_turret = ControlGetPos($gui,"",$turret)
      $cp_gui = ControlGetPos($gui,"",$gui)
      If $cp[0] < 300 And $cp[1] < 300 And $dead = False Then
         If $cp[1] < 0 Then
            ControlMove("","",$obj,$cp[0],$cp[1]+1)
            ControlMove("","",$prog,$cp[0]-25,$cp[1]-20)
            ControlMove($gui,"",$prog_b,$cp[0]-25,$cp[1]-20)
            Else
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
         EndIf
      EndIf
      If $cp[1] < 400 And $cp[1] >= 300 And $dead = False Then
         ControlMove("","",$obj,$cp[0]+1,$cp[1])
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
      EndIf
      If $cp[0] = 400 And $cp[1] < 550 And $dead = False Then
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
      EndIf
      If $cp[1] >= 550 Then
         ControlMove($gui,"",$obj,10,-50)
         ControlMove($gui,"",$prog,0,-70)
         lifelost()
         EndIf
         GUISetOnEvent(-3,"_Exit")
      Sleep(10)
      EndIf
      EndFunc

      Func death()
         $cp_hp = ControlGetPos($gui,"",$prog)
              If $cp_hp[2] = 0 And $dead = False Then
         $cp5 = ControlGetPos($gui,"",$obj)
         GUICtrlDelete($obj)
         GUICtrlDelete($prog)
         $exp = GUICtrlCreateInput("",$cp5[0]-25,$cp5[1]-35,100,100)
         GUICtrlSetState($exp,$gui_disable)
         GUICtrlSetBkColor($exp,0xFF0000)
         $dead = True
         deathreward()
         Sleep(1000)
         npc()
         $dead = False
         GUICtrlDelete($exp)
      EndIf
   EndFunc

   Func _Exit()
      Exit
   EndFunc

   Func rangecheck()
      $mp = GUIGetCursorInfo($gui)
      $cp = ControlGetPos($gui,"",$turret)
    ;  If $mp[0] >= $cp[0] And $mp[0] <= $cp[0]+$cp[2] And $mp[1] >= $cp[1] And $mp[1] <= $cp[1]+$cp[3] Then
        ; GUICtrlSetState($turret_range,$gui_show)
     ; EndIf
      If $mp[0] >= $cp[0] And $mp[1] >= $cp[1] And $mp[0] <= $cp[0]+$cp[2] And $mp[1] <= $cp[1]+$cp[3] Then
         GUICtrlSetState($turret_range,$gui_show)
      Else
         GUICtrlSetState($turret,$gui_hide)
         EndIf
      EndFunc

      Func lifelost()
         $lives = $lives - 2
         GUICtrlSetData($live,"Health: "&$lives&"/100")
      EndFunc

      Func deathreward()
         $bal = $bal + 15
         GUICtrlSetData($bank,"Bank: $"&$bal)
         EndFunc

Thanks in advance!

Link to comment
Share on other sites

I haven't run your code, so with only a quick look, I'm just presuming this is just a simple game you have created?

If you are moving controls around, by their ID, then that ID is a number, designated at create time, and is based on preceding number creation. This means, that if you remove an earlier number, then all latter ID numbers are reduced by one.

I'm not sure if this is what is happening, but that is what has occurred to me initially without taking your code apart, for which I don't have the testing facility at the moment. So this is just a quick reply that may help.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I'm using controlmove along with controlgetpos to move the objects around.

I have a checker for when the 1 npc moves off the bottom of the screen and when it moves off the screen it's supposed to move the health bar and the npc back to the top where it can move through the course again but for some reason it moves the button.

Link to comment
Share on other sites

Use MsgBox's throughout your code, to test on assigned values (variables).

That's all I can suggest at this point, sorry.

I'm part of the Quick Response Squad :blink: , no doubt someone will look more in-depth shortly (sooner or later). :D

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • Solution

I fixed the problem, I had a function in there that I made myself but when I deleted it I forgot to get rid of the variables.

Thanks for all the help guys.

If $cp[0] < 300 And $cp[1] < 300 And $dead = False Then
         If $cp[1] < 0 Then
            ControlMove("","",$obj,$cp[0],$cp[1]+1)
            ControlMove("","",$prog,$cp[0]-25,$cp[1]-20)
            ControlMove($gui,"",$prog_b,$cp[0]-25,$cp[1]-20) ;This is the error, just delete "$prog_b"
            Else
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
         EndIf
      EndIf
Edited by gottygolly
Link to comment
Share on other sites

I figured out the problem.

I had a function in there before but I deleted the function but I kept all the variables associated with the function.

If you copy and paste the code into the SciTE editor you'll see that it moves the wrong thing which was the problem but if you delete line 88 (Or comment it out) and also take out the variable --$prog_b-- in the global on line 2 it'll fix the problem.

Thanks for offering the help Detefon and Bert it's cool, I can see why you would assume that it is a bot but it's just a little towerdefence game im messing around with.

I added in some new features but I ran into another error where the npc spawns in dead...I'll keep looking unless someone  wants to help me out.

#include<guiconstants.au3>
Global $obj,$prog,$turret,$damage,$turrent,$turret_range,$bal,$bank,$lives,$live
Opt("GUIOnEventMode",1)
;Opt("GUICoordMode",1)
$gui = GUICreate("Box TowerDefense",@desktopwidth-500,@desktopheight-500,-1,-1)
$bal = 25000 ;<= Edit this for more $ to play around.
$bank = GUICtrlCreateLabel("Bank: $"&$bal,500,5,150,30)
$lives = 100 ;<= Incase something happens.
$live = GUICtrlCreateLabel("Health: "&$lives&"/100",500,25,150,30)
$round = 23 ;<= Editing this will allow you to adjust the round, note line 63 as it will increase the health.
$rounds = GUICtrlCreateLabel("Round: "&$round,500,45,150,30)
npc()
Local $s_lastsec = @SEC,$b_la = @SEC
$5_damage = GUICtrlCreateButton("Upgrade Damage +1 [$250]",500,100,150,30)
GUICtrlSetOnEvent($5_damage,"damage_upg")
$i = 0
$t = 0
$dead = False
$damage = 1 ;<= Starting damage
GUISetOnEvent(-3,"_Exit")
GUISetState()
While 1
   $b = @SEC
   movement()
   damage()
   death()
   If $b <> $b_la Then
      GUICtrlSetState($turret_range,$gui_hide)
   rangecheck()
   $b_la = $b
   If $round = 25 Then
      $msgbox = MsgBox(4,"Winner!","Congratulations you have reached round 25!"&@CRLF&"Do you wish to keep playing?")
      If $msgbox = 6 Then
         Sleep(100)
         $round += 1
         GUICtrlSetData($rounds,"Round: "&$round)
         Sleep(100)
         Else
      sleeper()
      EndIf
      ;ExitLoop
      EndIf
   EndIf
WEnd

Func damage_upg()
   ;#cs
   If $bal - 250 * $damage >= 0 Then
            $bal = $bal - 250 * $damage
            GUICtrlSetData($5_damage,"Upgrade Damage +1 [$"&250*$damage&"]")
            GUICtrlSetData($bank,"Bank: $"&$bal)
         $damage = $damage + 1
      Else
         MsgBox(0,"Error","Insufficient Funds")
      EndIf
    ;  #ce
    EndFunc
    Func damage()
      $cp = ControlGetPos($gui,"",$obj)
      $cp_turret = ControlGetPos($gui,"",$turret)
      $cp_range = ControlGetPos($gui,"",$turret_range)
      $t += 1
      $hp_change = $round * 2/5
      If $cp[0] + $cp[2] >= $cp_range[0] And $cp[1] >= $cp_range[1] And $cp[0] <= $cp_range[0]+$cp_range[2] And $cp[1] <= $cp_range[1]+$cp_range[3] And $t >= $hp_change Then
            $cp_hp = ControlGetPos($gui,"",$prog)
            $new_hp = $cp_hp[0] - $damage
            ;GUICtrlSetData($prog,$new_hp)
            ControlMove($gui,"",$prog,$cp_hp[0],$cp_hp[1],$cp_hp[2]-$damage)
            ;ControlMove($gui,"",$prog_b,$cp_hp[0],$cp_hp[1],$cp_hp[2],$cp_hp[3])
            $t = 0
            EndIf
   EndFunc

Func npc()
   $turret_range = GUICtrlCreateGroup("",50,-40,250,240)
   GUICtrlSetState($turret_range,$gui_hide)
   $obj = GUICtrlCreateInput("",10,0,50,50)
   $turret = GUICtrlCreateInput("",150,50,50,50)
   GUICtrlSetState($turret_range,128)
   GUICtrlSetState($turret,$gui_disable)
   GUICtrlSetBkColor($turret,0x0000FF)
GUICtrlSetState($obj,$gui_disable)
$prog = GUICtrlCreateButton("",0,-20,75,13)
GUICtrlSetBkColor($prog,0x00A000)
GUICtrlSetState($prog,$gui_disable)
GUICtrlSetBkColor($obj,0x000000)
Sleep(10)
EndFunc

Func movement()
   $s = @SEC
   If $s <> $s_lastsec Then
      $i += 1
      $cp = ControlGetPos($gui,"",$obj)
      $cp_turret = ControlGetPos($gui,"",$turret)
      $cp_gui = ControlGetPos($gui,"",$gui)
      If $cp[0] < 300 And $cp[1] < 300 And $dead = False Then
         If $cp[1] < 0 Then
            ControlMove("","",$obj,$cp[0],$cp[1]+1)
            ControlMove("","",$prog,$cp[0]-25,$cp[1]-20)
            ;ControlMove($gui,"",$prog_b,$cp[0]-25,$cp[1]-20)
            Else
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
         EndIf
      EndIf
      If $cp[1] < 400 And $cp[1] >= 300 And $dead = False Then
         ControlMove("","",$obj,$cp[0]+1,$cp[1])
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
      EndIf
      If $cp[0] = 400 And $cp[1] < 550 And $dead = False Then
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
      EndIf
      If $cp[1] >= 550 Then
         ControlMove($gui,"",$obj,10,-50) ;Here's the error.
         ControlMove($gui,"",$prog,0,-70)
         lifelost()
         EndIf
         GUISetOnEvent(-3,"_Exit")
      Sleep(10)
      EndIf
      EndFunc

      Func death()
         $cp_hp = ControlGetPos($gui,"",$prog)
              If $cp_hp[2] = 0 And $dead = False Then
         $cp5 = ControlGetPos($gui,"",$obj)
         GUICtrlDelete($obj)
         GUICtrlDelete($prog)
         $exp = GUICtrlCreateInput("",$cp5[0]-25,$cp5[1]-35,100,100)
         GUICtrlSetState($exp,$gui_disable)
         GUICtrlSetBkColor($exp,0xFF0000)
         deathreward()
         $round += 1
         GUICtrlSetData($rounds,"Round: "&$round)
         Sleep(1000)
         $dead = False
         GUICtrlDelete($exp)
         npc()
      EndIf
   EndFunc

   Func _Exit()
      Exit
   EndFunc

   Func rangecheck()
      $mp = GUIGetCursorInfo($gui)
      $cp = ControlGetPos($gui,"",$turret)
    ;  If $mp[0] >= $cp[0] And $mp[0] <= $cp[0]+$cp[2] And $mp[1] >= $cp[1] And $mp[1] <= $cp[1]+$cp[3] Then
        ; GUICtrlSetState($turret_range,$gui_show)
     ; EndIf
      If $mp[0] >= $cp[0] And $mp[1] >= $cp[1] And $mp[0] <= $cp[0]+$cp[2] And $mp[1] <= $cp[1]+$cp[3] Then
         GUICtrlSetState($turret_range,$gui_show)
      Else
         GUICtrlSetState($turret,$gui_hide)
         EndIf
      EndFunc

      Func lifelost()
         $lives = $lives - 2
         GUICtrlSetData($live,"Health: "&$lives&"/100")
      EndFunc

      Func deathreward()
         $bal = $bal + 15
         GUICtrlSetData($bank,"Bank: $"&$bal)
      EndFunc

      Func sleeper()
         Do
            Sleep(10)
         Until GUIGetMsg() = -3
         Exit
         EndFunc
Edited by gottygolly
Link to comment
Share on other sites

Like the red box appears then disappears and a black box appears and there is nothing else in the gui?

--Just put the background/colors in--

#include<guiconstants.au3>
Global $obj,$prog,$turret,$damage,$turrent,$turret_range,$bal,$bank,$lives,$live
Opt("GUIOnEventMode",1)
;Opt("GUICoordMode",1)
$gui = GUICreate("Box TowerDefense",@desktopwidth-500,@desktopheight-500,-1,-1)
GUISetBkColor(0x009900)
$toggles_back = 0x999999
$toggles = GUICtrlCreateLabel("",495,5,@DesktopWidth-1000,@DesktopHeight-510)
GUICtrlSetBkColor($toggles,$toggles_back)
$bal = 25000 ;<= Edit this for more $ to play around.
$bank = GUICtrlCreateLabel("Bank: $"&$bal,500,15,150,30)
GUICtrlSetBkColor($bank,$toggles_back)
$lives = 100 ;<= Incase something happens.
$live = GUICtrlCreateLabel("Health: "&$lives&"/100",500,35,150,30)
GUICtrlSetBkColor($live,$toggles_back)
$round = 23 ;<= Editing this will allow you to adjust the round, note line 63 as it will increase the health.
$rounds = GUICtrlCreateLabel("Round: "&$round,500,55,150,30)
GUICtrlSetBkColor($rounds,$toggles_back)
npc()
road()
Local $s_lastsec = @SEC,$b_la = @SEC
$5_damage = GUICtrlCreateButton("Upgrade Damage +1 [$250]",500,100,150,30)
GUICtrlSetOnEvent($5_damage,"damage_upg")
$i = 0
$t = 0
$dead = False
$damage = 1 ;<= Starting damage
GUISetOnEvent(-3,"_Exit")
GUISetState()
While 1
   $b = @SEC
   movement()
   damage()
   death()
   If $b <> $b_la Then
      GUICtrlSetState($turret_range,$gui_hide)
   rangecheck()
   $b_la = $b
   If $round = 25 Then
      $msgbox = MsgBox(4,"Winner!","Congratulations you have reached round 25!"&@CRLF&"Do you wish to keep playing?")
      If $msgbox = 6 Then
         Sleep(100)
         $round += 1
         GUICtrlSetData($rounds,"Round: "&$round)
         Sleep(100)
         Else
      sleeper()
      EndIf
      ;ExitLoop
      EndIf
   EndIf
WEnd

Func damage_upg()
   ;#cs
   If $bal - 250 * $damage >= 0 Then
            $bal = $bal - 250 * $damage
            GUICtrlSetData($5_damage,"Upgrade Damage +1 [$"&250*$damage&"]")
            GUICtrlSetData($bank,"Bank: $"&$bal)
         $damage = $damage + 1
      Else
         MsgBox(0,"Error","Insufficient Funds")
      EndIf
    ;  #ce
    EndFunc
    Func damage()
      $cp = ControlGetPos($gui,"",$obj)
      $cp_turret = ControlGetPos($gui,"",$turret)
      $cp_range = ControlGetPos($gui,"",$turret_range)
      $t += 1
      $hp_change = $round * 2/5
      If $cp[0] + $cp[2] >= $cp_range[0] And $cp[1] >= $cp_range[1] And $cp[0] <= $cp_range[0]+$cp_range[2] And $cp[1] <= $cp_range[1]+$cp_range[3] And $t >= $hp_change Then
            $cp_hp = ControlGetPos($gui,"",$prog)
            $new_hp = $cp_hp[0] - $damage
            ;GUICtrlSetData($prog,$new_hp)
            ControlMove($gui,"",$prog,$cp_hp[0],$cp_hp[1],$cp_hp[2]-$damage)
            ;ControlMove($gui,"",$prog_b,$cp_hp[0],$cp_hp[1],$cp_hp[2],$cp_hp[3])
            $t = 0
            EndIf
   EndFunc

Func npc()
   $turret_range = GUICtrlCreateGroup("",50,-40,250,240)
   GUICtrlSetState($turret_range,$gui_hide)
   $obj = GUICtrlCreateInput("",10,0,50,50)
   $turret = GUICtrlCreateInput("",150,50,50,50)
   GUICtrlSetState($turret_range,128)
   GUICtrlSetState($turret,$gui_disable)
   GUICtrlSetBkColor($turret,0x0000FF)
GUICtrlSetState($obj,$gui_disable)
$prog = GUICtrlCreateButton("",0,-20,75,13)
GUICtrlSetBkColor($prog,0x00A000)
GUICtrlSetState($prog,$gui_disable)
GUICtrlSetBkColor($obj,0x000000)
Sleep(10)
EndFunc

Func movement()
   $s = @SEC
   If $s <> $s_lastsec Then
      $i += 1
      $cp = ControlGetPos($gui,"",$obj)
      $cp_turret = ControlGetPos($gui,"",$turret)
      $cp_gui = ControlGetPos($gui,"",$gui)
      If $cp[0] < 300 And $cp[1] < 300 And $dead = False Then
         If $cp[1] < 0 Then
            ControlMove("","",$obj,$cp[0],$cp[1]+1)
            ControlMove("","",$prog,$cp[0]-25,$cp[1]-20)
            ;ControlMove($gui,"",$prog_b,$cp[0]-25,$cp[1]-20)
            Else
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
         EndIf
      EndIf
      If $cp[1] < 400 And $cp[1] >= 300 And $dead = False Then
         ControlMove("","",$obj,$cp[0]+1,$cp[1])
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
      EndIf
      If $cp[0] = 400 And $cp[1] < 550 And $dead = False Then
         ControlMove("","",$obj,$cp[0],$cp[1]+1)
         ControlMove("","",$prog,$cp[0]-10,$cp[1]-20)
      EndIf
      If $cp[1] >= 550 Then
         ControlMove($gui,"",$obj,10,-50) ;Here's the error.
         ControlMove($gui,"",$prog,0,-70)
         lifelost()
         EndIf
         GUISetOnEvent(-3,"_Exit")
      Sleep(10)
      EndIf
      EndFunc

      Func death()
         $cp_hp = ControlGetPos($gui,"",$prog)
              If $cp_hp[2] = 0 And $dead = False Then
         $cp5 = ControlGetPos($gui,"",$obj)
         GUICtrlDelete($obj)
         GUICtrlDelete($prog)
         $exp = GUICtrlCreateInput("",$cp5[0]-25,$cp5[1]-35,100,100)
         GUICtrlSetState($exp,$gui_disable)
         GUICtrlSetBkColor($exp,0xFF0000)
         deathreward()
         $round += 1
         GUICtrlSetData($rounds,"Round: "&$round)
         Sleep(1000)
         $dead = False
         GUICtrlDelete($exp)
         npc()
      EndIf
   EndFunc

   Func _Exit()
      Exit
   EndFunc

   Func rangecheck()
      $mp = GUIGetCursorInfo($gui)
      $cp = ControlGetPos($gui,"",$turret)
    ;  If $mp[0] >= $cp[0] And $mp[0] <= $cp[0]+$cp[2] And $mp[1] >= $cp[1] And $mp[1] <= $cp[1]+$cp[3] Then
        ; GUICtrlSetState($turret_range,$gui_show)
     ; EndIf
      If $mp[0] >= $cp[0] And $mp[1] >= $cp[1] And $mp[0] <= $cp[0]+$cp[2] And $mp[1] <= $cp[1]+$cp[3] Then
         GUICtrlSetState($turret_range,$gui_show)
      Else
         GUICtrlSetState($turret,$gui_hide)
         EndIf
      EndFunc

      Func lifelost()
         $lives = $lives - 2
         GUICtrlSetData($live,"Health: "&$lives&"/100")
      EndFunc

      Func deathreward()
         $bal = $bal + 15
         GUICtrlSetData($bank,"Bank: $"&$bal)
      EndFunc

      Func sleeper()
         Do
            Sleep(10)
         Until GUIGetMsg() = -3
         Exit
      EndFunc

      Func road()
         $road_1 = GUICtrlCreateLabel("",0,0,80,360)
         GUICtrlSetBkColor($road_1,0x775511)
         $road_2 = GUICtrlCreateLabel("",70,270,390,90)
         GUICtrlSetBkColor($road_2,0x775511)
         $road_3 = GUICtrlCreateLabel("",380,360,80,170)
         GUICtrlSetBkColor($road_3,0x775511)
         EndFunc
Edited by gottygolly
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...