Jump to content

just a little monsterslaying


Nuffilein805
 Share

Recommended Posts

i just did some little programming to do a monsterslaying-prog

it has no real use and the idea is from bulletmonk i just did the programming

#include<guiconstants.au3>; for guicreation
$main = guicreate ("Main Window", 300, 200); main window of gui

;middle information
$health = guictrlcreatelabel ("Health", 100, 40, 100)
$mindmg = guictrlcreatelabel ("MinDmg", 100, 70, 100)
$maxdmg = guictrlcreatelabel ("MaxDmg", 100, 100, 100)

;hero stats
$hero = guictrlcreatelabel ("Hero", 10, 10, 130)
$hero_health = guictrlcreateedit (100, 10, 40, 80)
$hero_mindmg = guictrlcreateedit (0, 10, 70, 80)
$hero_maxdmg = guictrlcreateedit (10, 10, 100, 80)

;monster stats
$monster = guictrlcreatelabel ("Monster", 160, 10, 130)
$monster_health = guictrlcreateedit (150, 210, 40, 80)
$monster_mindmg = guictrlcreateedit (1, 210, 70, 80)
$monster_maxdmg = guictrlcreateedit (5, 210, 100, 80)

;fight_button
$fight = guictrlcreatebutton ("Fight", 10, 130, 280)

;make gui visible
guisetstate()

;infinite loop
while 1
;get which button is pressed
$msg = guigetmsg()
;multiple options
select
;X-Button
case $msg = $GUI_EVENT_CLOSE
exit
;Fight-Button
case $msg = $fight
;info to variable
$hh = guictrlread($hero_health)
$hmi = guictrlread ($hero_mindmg)
$hma = guictrlread ($hero_maxdmg)
$mh = guictrlread ($monster_health)
$mmi = guictrlread ($monster_mindmg)
$mma = guictrlread ($monster_maxdmg)
;start function
battle()
;end of multiple options
endselect
;end of loop
wend

;now the battlingfunction
func battle()
;loop until someone is dead
do
;herodamage
$hd = random ($hmi, $hma, 1)
;monsterhealth
$mh = $mh - $hd
;monsterdamage
$md = random ($mmi, $mma, 1)
;herohealth
$hh = $hh - $md
;update the gui
guictrlsetdata ($hero_health, $hh)
guictrlsetdata ($monster_health, $mh)
;sleep so you can see what happens
sleep (500)
;until someone is dead
until $hh < 1 or $mh < 1
;if its the hero
if $hh < 1 then
;messagebox he's dead
msgbox (0, "Someone died", "OMG it's the hero!")
endif
;if its the monster
if $mh < 1 then
;messagebox he did it
msgbox (0, "Someone died", "Yeah the monster is dead!")
endif
endfunc

have fun

19 October 2005 updated the file

20 October 2005 included pix updated file

21 October 2005 i see some people got difficulties with this script now - plz download the script + the 2 pics and put it in 1 folder

02 November 2005 updated the game a bit (too much free time) (last 1 was downloaded 28 times)

monsterslaying_a.au3

Edited by Nuffilein805
Link to comment
Share on other sites

Hi!

Some results of first testing:

- negative values for the health should be replaced by "0".

- some kind of *simple* graphics would be nice.

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi again!

Please reset the values to the userdifened ones after the fight, so that the fight can be restarted instantly.

And give another input for the animation speed.

Please take all these pints as constructive critic and not offensively!

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi again!

Please reset the values to the userdifened ones after the fight, so that the fight can be restarted instantly.

And give another input for the animation speed.

Please take all these pints as constructive critic and not offensively!

peethebee

here you are

everything except the graphic

$hh1 = 0
$hmi1 = 0
$hma1 = 0
$mh1 = 0
$mmi1 = 0
$mma1 = 0

#include<guiconstants.au3>; for guicreation
$main = guicreate ("Main Window", 300, 200); main window of gui

;middle information
$health = guictrlcreatelabel ("Health", 100, 40, 100)
$mindmg = guictrlcreatelabel ("MinDmg", 100, 70, 100)
$maxdmg = guictrlcreatelabel ("MaxDmg", 100, 100, 100)

;hero stats
$hero = guictrlcreatelabel ("Hero", 10, 10, 130)
$hero_health = guictrlcreateedit (100, 10, 40, 80)
$hero_mindmg = guictrlcreateedit (0, 10, 70, 80)
$hero_maxdmg = guictrlcreateedit (10, 10, 100, 80)

;monster stats
$monster = guictrlcreatelabel ("Monster", 160, 10, 130)
$monster_health = guictrlcreateedit (150, 210, 40, 80)
$monster_mindmg = guictrlcreateedit (1, 210, 70, 80)
$monster_maxdmg = guictrlcreateedit (5, 210, 100, 80)

;fight_button
$fight = guictrlcreatebutton ("Fight", 10, 130, 140)
;reset_button
$reset = GUICtrlCreateButton ("Reset to Preset", 150, 130, 140)
;save_user_data
$save = GUICtrlCreateButton ("Save", 10, 160, 140)
;second reset
$reset2 = GUICtrlCreateButton ("Reset to Saved", 150, 160, 140)
;make gui visible
guisetstate()

;infinite loop
while 1
;get which button is pressed
$msg = guigetmsg()
;multiple options
select
;X-Button
case $msg = $GUI_EVENT_CLOSE
exit
;Fight-Button
case $msg = $fight
;info to variable
$hh = guictrlread($hero_health)
$hmi = guictrlread ($hero_mindmg)
$hma = guictrlread ($hero_maxdmg)
$mh = guictrlread ($monster_health)
$mmi = guictrlread ($monster_mindmg)
$mma = guictrlread ($monster_maxdmg)
;start function
battle()
;Reset-Button
case $msg = $reset
guictrlsetdata ($hero_health, 100)
guictrlsetdata ($monster_health, 150)
guictrlsetdata ($hero_mindmg, 0)
GUICtrlSetData ($hero_maxdmg, 10)
GUICtrlSetData ($monster_mindmg, 1)
GUICtrlSetData ($monster_maxdmg, 5)
;Save-Button
case $msg = $save
$hh1 = guictrlread($hero_health)
$hmi1 = guictrlread ($hero_mindmg)
$hma1 = guictrlread ($hero_maxdmg)
$mh1 = guictrlread ($monster_health)
$mmi1 = guictrlread ($monster_mindmg)
$mma1 = guictrlread ($monster_maxdmg)
;2nd Reset-Button
case $msg = $reset2
if $hh1 <> 0 Then
guictrlsetdata ($hero_health, $hh1)
guictrlsetdata ($monster_health, $mh1)
guictrlsetdata ($hero_mindmg, $hmi1)
GUICtrlSetData ($hero_maxdmg, $hma1)
GUICtrlSetData ($monster_mindmg, $mmi1)
GUICtrlSetData ($monster_maxdmg, $mma1)
Else
msgbox (0, "Error", "No stored information")
endif
;end of multiple options
endselect
;end of loop
wend

;now the battlingfunction
func battle()
;loop until someone is dead
do
;herodamage
$hd = random ($hmi, $hma, 1)
;monsterhealth
$mh = $mh - $hd
;monsterdamage
$md = random ($mmi, $mma, 1)
;herohealth
$hh = $hh - $md
;update the gui
guictrlsetdata ($hero_health, $hh)
guictrlsetdata ($monster_health, $mh)
;sleep so you can see what happens
sleep (500)
;until someone is dead
until $hh < 1 or $mh < 1
;if its the hero
if $hh < 1 then
GUICtrlSetData ($hero_health, 0)
;messagebox he's dead
msgbox (0, "Someone died", "OMG it's the hero!")
endif
;if its the monster
if $mh < 1 then
GUICtrlSetData ($monster_health, 0)
;messagebox he did it
msgbox (0, "Someone died", "Yeah the monster is dead!")
endif
endfunc

hope you like it

as i said i'm just into a far more complex version of this, so just tell me what you want to be changed

just added a new script

original will be replaced soon

Edited by Nuffilein805
Link to comment
Share on other sites

ok i added 1 more option (speed) cause i hate it if your using quite a lot of health for your game it takes forever

here is the new script:

$hh1 = 0
$hmi1 = 0
$hma1 = 0
$mh1 = 0
$mmi1 = 0
$mma1 = 0

dim $label[301][201]
#include<guiconstants.au3>; for guicreation
$main = guicreate ("Main Window", 300, 250); main window of gui

;middle information
$health = guictrlcreatelabel ("Health", 100, 40, 100)
$mindmg = guictrlcreatelabel ("MinDmg", 100, 70, 100)
$maxdmg = guictrlcreatelabel ("MaxDmg", 100, 100, 100)

;hero stats
$hero = guictrlcreatelabel ("Hero", 10, 10, 130)
$hero_health = guictrlcreateedit (100, 10, 40, 80)
$hero_mindmg = guictrlcreateedit (0, 10, 70, 80)
$hero_maxdmg = guictrlcreateedit (10, 10, 100, 80)

;monster stats
$monster = guictrlcreatelabel ("Monster", 160, 10, 130)
$monster_health = guictrlcreateedit (150, 210, 40, 80)
$monster_mindmg = guictrlcreateedit (1, 210, 70, 80)
$monster_maxdmg = guictrlcreateedit (5, 210, 100, 80)

;fight_button
$fight = guictrlcreatebutton ("Fight", 10, 130, 140)
;reset_button
$reset = GUICtrlCreateButton ("Reset to Preset", 150, 130, 140)
;save_user_data
$save = GUICtrlCreateButton ("Save", 10, 160, 140)
;second reset
$reset2 = GUICtrlCreateButton ("Reset to Saved", 150, 160, 140)

;speed, because if you use high health it takes ages
$speed = GUICtrlCreateInput (1, 100, 190, 100)
GUICtrlSetLimit (GUICtrlCreateUpdown ($speed), 10, 1)

;make gui visible
guisetstate()

;infinite loop
while 1
;get which button is pressed
$msg = guigetmsg()
;multiple options
select
;X-Button
case $msg = $GUI_EVENT_CLOSE
exit
;Fight-Button
case $msg = $fight
;info to variable
$hh = guictrlread($hero_health)
$hmi = guictrlread ($hero_mindmg)
$hma = guictrlread ($hero_maxdmg)
$mh = guictrlread ($monster_health)
$mmi = guictrlread ($monster_mindmg)
$mma = guictrlread ($monster_maxdmg)
;start function
battle()
;Reset-Button
case $msg = $reset
guictrlsetdata ($hero_health, 100)
guictrlsetdata ($monster_health, 150)
guictrlsetdata ($hero_mindmg, 0)
GUICtrlSetData ($hero_maxdmg, 10)
GUICtrlSetData ($monster_mindmg, 1)
GUICtrlSetData ($monster_maxdmg, 5)
;Save-Button
case $msg = $save
$hh1 = guictrlread($hero_health)
$hmi1 = guictrlread ($hero_mindmg)
$hma1 = guictrlread ($hero_maxdmg)
$mh1 = guictrlread ($monster_health)
$mmi1 = guictrlread ($monster_mindmg)
$mma1 = guictrlread ($monster_maxdmg)
;2nd Reset-Button
case $msg = $reset2
if $hh1 <> 0 Then
guictrlsetdata ($hero_health, $hh1)
guictrlsetdata ($monster_health, $mh1)
guictrlsetdata ($hero_mindmg, $hmi1)
GUICtrlSetData ($hero_maxdmg, $hma1)
GUICtrlSetData ($monster_mindmg, $mmi1)
GUICtrlSetData ($monster_maxdmg, $mma1)
Else
msgbox (0, "Error", "No stored information")
EndIf
;end of multiple options
endselect
;end of loop
wend

;now the battlingfunction
func battle()
;loop until someone is dead
do
;herodamage
$hd = random ($hmi, $hma, 1)
;monsterhealth
$mh = $mh - $hd
;monsterdamage
$md = random ($mmi, $mma, 1)
;herohealth
$hh = $hh - $md
;update the gui
guictrlsetdata ($hero_health, $hh)
guictrlsetdata ($monster_health, $mh)
;sleep_func so you can see what happens
sleepfunc()
;until someone is dead
until $hh < 1 or $mh < 1
;if its the hero
if $hh < 1 then
GUICtrlSetData ($hero_health, 0)
;messagebox he's dead
msgbox (0, "Someone died", "OMG it's the hero!")
endif
;if its the monster
if $mh < 1 then
GUICtrlSetData ($monster_health, 0)
;messagebox he did it
msgbox (0, "Someone died", "Yeah the monster is dead!")
endif
endfunc

func sleepfunc()
$level = guictrlread ($speed)
Select
case $level = 1 
    $time = 1000
case $level = 2
    $time = 800
case $level = 3
    $time = 700
case $level = 4
    $time = 600
case $level = 5
    $time = 500
case $level = 6
    $time = 400
case $level = 7
    $time = 300
case $level = 8
    $time = 200
case $level = 9
    $time = 100
case $level = 10
    $time = 0
EndSelect
sleep ($time)
EndFunc

to make the game go really fast just choose 10

have fun

i'll update the file in a minute

Link to comment
Share on other sites

Hi!

I'm using Win XP Home.

Thanks for the speed option. What do you think about some graphical things?

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

I do not know what you could add, but I don't thnik that you should too much energy in this program as AutoIt has much more and (sorry) much more useful applications than this little game.

Please don't take this offensive!

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Nice job Nuffilein.

I'd like to see, if possible, after clicking the Fight button, a progress bar for the Hero and the Monster, and watch them get smaller as the fight takes place. I think this script could make a good example for other people trying to learn Autoit.

Thanks,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Nice job Nuffilein.

I'd like to see, if possible, after clicking the Fight button, a progress bar for the Hero and the Monster, and watch them get smaller as the fight takes place. I think this script could make a good example for other people trying to learn Autoit.

Thanks,

Ian

ok i'll think of that

we'll see what comes up next

all the ideas you guys gave me are in a big pot (actually a random-script) and whatever comes out next, that's what i'm trying to do

Link to comment
Share on other sites

Good job, I like how you can watch it count backwards for Health.

If I get some time, I'll try to add progress bars counting backwards. Because, it's something I'd like to see, and it would be good practice for me.

Keep it up.

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Hi!

It does not work:

- I can fight only once (did not perceive the MsgBox, cause it was not top-most)

- the values are not set back after a fight (same as above)

- no pix

What's wrong? Running it with 3.1.1

Please don't take it offensively!

peethebee

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

It does not work:

- I can fight only once (did not perceive the MsgBox, cause it was not top-most)

- the values are not set back after a fight (same as above)

- no pix

What's wrong? Running it with 3.1.1

Please don't take it offensively!

peethebee

have you downloaded the pix?

seems to work alright on every pc i tried

there are lots of i can try B)

Link to comment
Share on other sites

Hi!

Now it works. Perhaps you add more different pics to show the status of the hero and the monster?

e.g. with blood if it is half-damaged.

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

Now it works. Perhaps you add more different pics to show the status of the hero and the monster?

e.g. with blood if it is half-damaged.

peethebee

i'll think about that but

maybe i can google some out or change these

but the next time i post this script i'll have to do an installer B) (well, a zip-file should do)

Link to comment
Share on other sites

  • 2 weeks later...

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