Nuffilein805 Posted October 18, 2005 Posted October 18, 2005 (edited) 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 expandcollapse popup#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 November 2, 2005 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot
Nuffilein805 Posted October 18, 2005 Author Posted October 18, 2005 i'm still updating so if you want some changes plz tell me i'll do my very best to put every usefull thing in the script don't ask for 3-d-games! my little chatmy little encryption toolmy little hidermy unsafe clickbot
peethebee Posted October 18, 2005 Posted October 18, 2005 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
peethebee Posted October 18, 2005 Posted October 18, 2005 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
Nuffilein805 Posted October 18, 2005 Author Posted October 18, 2005 (edited) 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!peethebeehere you areeverything except the graphicexpandcollapse popup$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 endfunchope you like itas i said i'm just into a far more complex version of this, so just tell me what you want to be changedjust added a new scriptoriginal will be replaced soon Edited October 18, 2005 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot
Nuffilein805 Posted October 18, 2005 Author Posted October 18, 2005 funny, now that i edited the script the hero wins sometimes i even had a draw my little chatmy little encryption toolmy little hidermy unsafe clickbot
Nuffilein805 Posted October 19, 2005 Author Posted October 19, 2005 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: expandcollapse popup$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 my little chatmy little encryption toolmy little hidermy unsafe clickbot
Nuffilein805 Posted October 19, 2005 Author Posted October 19, 2005 does noone use win2k here? noone reported that there is a problem in my script with win2k fixed that my little chatmy little encryption toolmy little hidermy unsafe clickbot
peethebee Posted October 19, 2005 Posted October 19, 2005 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
Nuffilein805 Posted October 19, 2005 Author Posted October 19, 2005 Hi!I'm using Win XP Home.Thanks for the speed option. What do you think about some graphical things?peethebeei think i'll include some soon, something else you'd like to have? my little chatmy little encryption toolmy little hidermy unsafe clickbot
peethebee Posted October 19, 2005 Posted October 19, 2005 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
ioliver Posted October 19, 2005 Posted October 19, 2005 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
Nuffilein805 Posted October 19, 2005 Author Posted October 19, 2005 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, Ianok i'll think of thatwe'll see what comes up nextall 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 my little chatmy little encryption toolmy little hidermy unsafe clickbot
Nuffilein805 Posted October 20, 2005 Author Posted October 20, 2005 little update again (included pix) so its nothing special the big 1 is still at work updated file in first post my little chatmy little encryption toolmy little hidermy unsafe clickbot
ioliver Posted October 20, 2005 Posted October 20, 2005 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
peethebee Posted October 21, 2005 Posted October 21, 2005 (edited) 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 pixWhat's wrong? Running it with 3.1.1Please don't take it offensively!peethebee Edited October 21, 2005 by peethebee vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Nuffilein805 Posted October 21, 2005 Author Posted October 21, 2005 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 pixWhat's wrong? Running it with 3.1.1Please don't take it offensively!peethebeehave you downloaded the pix?seems to work alright on every pc i triedthere are lots of i can try my little chatmy little encryption toolmy little hidermy unsafe clickbot
peethebee Posted October 22, 2005 Posted October 22, 2005 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
Nuffilein805 Posted October 22, 2005 Author Posted October 22, 2005 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.peethebeei'll think about that butmaybe i can google some out or change thesebut the next time i post this script i'll have to do an installer (well, a zip-file should do) my little chatmy little encryption toolmy little hidermy unsafe clickbot
Nuffilein805 Posted November 2, 2005 Author Posted November 2, 2005 added some more interactivity you can now choose where to attack the monster and where you want to block have fun trying this out and give me some more things to implement (some suggestion would be nice - no progressbar pls:)) my little chatmy little encryption toolmy little hidermy unsafe clickbot
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now