Sign in to follow this  
Followers 0
Fubb

A simple "Yes/No" Game

27 posts in this topic

New to the community here, and pretty much a n00b at AutoIt, but i had aidea for an extremely simple game.

It'll be based on the day the recon aircraft flying over Cuba discovered the launch site, thus begining the Cuban Missile Crisis. As the President, you will have to be consaulted by ministers about the current situation. They'll give you an option, and youll get to rpely "Yes" or "No". If one says "Yes" then youll have a different string of questions coming for you then if you said no, because, well, if you said "no" certain things wouldn't have happened.

Well, each "yes" or "No" will advance time on a certain interval, e.g one may advance time by 1 hour, 1 day, 5hours, 30 minutes, so on so forth, andyou choices will decide whether or not the Cuban |Missile crisis will have a good ending for you, those dang Commies', or everyone, or...No one. (Boom)

And depending on your choices you'll get certain points, and at the end youll get them totalled, and ya....

So. I can't do this with a simple "Msgbox", so heres the first issue. I need a GUI. I've never made a GUI. Hazah. Also the last time i used actual functions was like....oh gosh....probably atleast 6 months ago by now, because i had a big time of "Not using AutoIT" in summer, so im fairly rusty.

Being to lazy to search for tutorials doesn't help either.

yay


Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites



@Fubb

Welcome to autoit forum :)

Dont forget to :

-Search on forum and helpfile before posting

-Read FAQs now

Look at MsgBox ; TimerInit ; TimerDiff

Its kind simple :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Well, as i said, im basically a n00b. Explain what i could do in the message box, so if I said "Yes" a different string would come up, and if I said "no" a different string would come up.

EDIT: Also i want to use pictures in it if possible, which is where the GUI would come in handy, no?

Edited by Fubb

Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites

@Fubb

How to use helpfile : Q20 in FAQs (Sticky on this forum)

$choice = MsgBox(32, "Yes/No", "Ok or Cancel ?")

If $choice = 1 Then
MsgBox(64, "Yes/No", "Ok Clicked !")
ElseIf $choice = 2 Then
MsgBox(64, "Yes/No", "Cancel Clicked !")
EndIf

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

in this, choice 1 is "Ok" and 2 is cancel?


Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites

@Fubb

$GUI = GuiCreate("GUI", 200, 200)
GuiCtrlCreatePic("yourpath.ext", 5, 5)
GuiSetState(@SW_SHOW, $GUI)

While 1 ;start loop (script wont exit until exit function or ExitLoop)
Sleep(250) ;always repeated
WEnd

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

in this, choice 1 is "Ok" and 2 is cancel?

Yup, now please read what I told you...

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

well problem is i can only get on at school and my friends laptop (which im not installing AutoIt to it) but its on my actual computer, only problem is.....it died on saturday. Motherboard burnt. Thankgod, that thing was 8 years old, but luckily our 500GB internal harddrive is FINE :) but we were supposed to have our new PC by tommorrow so i could have my autoit on it, but now its not goona come til NEXT week. A similar story to the Fallout 3 i ordered 4 weeks ago. Still hasn't come in. It was supposed to be in by the end of Week 2.

:\ Canada must be like, the epicenter of slow delivery.


Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites

Okee Dokee, im back at school, and am going to start creation of the game. You'll know if i have problems :) Cause ill let you know.

:]


Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites

Wow, I like this idea of a simple game :) Nice idea mate! I suggest using InputBox() instead of a message box, But thats just me... a msgbox will work the same.. But if you start to learn some more and wanted to go into bigger answers inputbox() would be the way to go! :) well good luck mate, Im eager to see this finished project :huh2: and if you need anymore help with anything dont hesitate to ask or PM me ^_^


*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites

OR you can use GUI, its relatively easy goin g just when a button is pressed hide and unhide labels, use timerinit() and timediff() its not really hard i made a simple point and clieck game my self check my sig but yeah

WELCOME TO THE FORUMS FUBB!

but really use the helpfile its your best friend

Share this post


Link to post
Share on other sites

*Sigh*

I guess I have no choice. This isn't liek the good ole' days where the coders coded by themselves, no help, no help files, or nothing...

*cough*not that I would know*cough*

Actually I guess it's a good thing we've turned into a global community on relying on the intellegiance (spelling?) of others in order for our selves to "Rise to the top"

So. Yes.


Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites

i know im a terrible speller lol...

but yeah thats why the forums are here

Share this post


Link to post
Share on other sites

^^ What he said...The AutoIT help file is the best info. Ive every come across for the a scripting language... seriously its straight to the point and you can search a specific function with no bullshit + whats related to it... Try to do that with MSDN...(lolz) youll get like a google search a bunch of crap your not even looking for.. But seriously just use the search section for any questions you might have about certain functions. Thats how I learned


*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Here is a structure you could use... it ONE way you could do it.

Global $q = "This is the first question", $answers = ""
While 1
    $response = MsgBox(3, "Question #" & StringLen($answers) + 1, $q)
    If $response = 2 Then Exit
    _NextQ($response)
WEnd

Func _NextQ($i_response)
    $answers &= $i_response
    Select
        Case $answers = "6"
            $q = "This is the question I want to ask if you chose YES"
        Case $answers = "7"
            $q = "This is the question I want to ask if you chose NO"
        Case $answers = "66"
            $q = "This is the question I want to ask if you chose YES-YES"
        Case $answers = "67"
            $q = "This is the question I want to ask if you chose YES-NO"
        Case $answers = "76"
            $q = "This is the question I want to ask if you chose NO-YES"
        Case Else
            MsgBox(16, "Error", "Unexpected sequence of answers:" & @CRLF & $answers)
            Exit
    EndSelect
EndFunc   ;==>_NextQ

[edit] tweaked code just a little [/edit]

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

one problem with that code that ihave is, the 6 is yes, the 7 is no, but ill eventually get into confusingly long seqeunces, and in turn will then have to have things like 6676776767766 or some such nonsense. Is there a way to do it a different way? Also, some questions will require only a "Continue" button. How do I make it so i put just that into the Case $answers code? Or...

Also, it has come to my attention lately that, Laptops without mice, suck :[

I cannot wait until our nw pc comes in...


Current Projects:"Cuban Missile Crisis" Decisions Game, -----------------------------------------------"I have got a lovely bunch of Coconust""Nuts*""Damn the songs ruined now" ~TheChosen

Share this post


Link to post
Share on other sites

like i said this would be easyer if you used GUIcreate() and butons and lables....

Share this post


Link to post
Share on other sites

one problem with that code that ihave is, the 6 is yes, the 7 is no, but ill eventually get into confusingly long seqeunces, and in turn will then have to have things like 6676776767766 or some such nonsense. Is there a way to do it a different way?

[snip]

You could make it "slightly" more readable by replacing 6 and 7 with Y and N respectively:

Global $q = "This is the first question", $answers = ""
While 1
    $response = MsgBox(3, "Question #" & StringLen($answers) + 1, $q)
    If $response = 2 Then Exit
    _NextQ($response)
WEnd

Func _NextQ($i_response)
    If $i_response = 6 Then
        $i_response = "Y"
    Else
        $i_response = "N"
    EndIf
    $answers &= $i_response
    Select
        Case $answers = "Y"
            $q = "This is the question I want to ask if you chose YES"
        Case $answers = "N"
            $q = "This is the question I want to ask if you chose NO"
        Case $answers = "YY"
            $q = "This is the question I want to ask if you chose YES-YES"
        Case $answers = "NY"
            $q = "This is the question I want to ask if you chose NO-YES"
        Case $answers = "NYY"
            $q = "This is the question I want to ask if you chose NO-YES-YES"
        Case $answers = "NYYN"
            MsgBox(0, "Question 5 Part 1", "First part of next question")
            MsgBox(0, "Question 5 Part 2", "Second part of next question")
            $q = "This is the last part of the question I want to ask if you chose NO-YES-YES-NO"
        Case Else
            MsgBox(16, "Error", "Unexpected sequence of answers")
            Exit
    EndSelect
EndFunc   ;==>_NextQ

I don't know if that is any less confusing when you have to write the appropriate question for every possible permutation... but that's what your looking at any way you go as far as I can see.

You should be able to see the way I included the continuation question you asked in the section of code under NYYN.

-Spook


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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