- Home /
How could I write a script for this? Is there another solution?
I want to make a Q&A game and I need help.
The idea is very simple. The game asks the player a question and the player would have an Inputfield to type in the right answer.
For example. What is the name of the capital of Spain? If the player types something else that is not Madrid then I would like a message to pop up saying "that's incorrect" and stays in the same question, but if it is the right answer then I want a message that says "good job!" and then it goes to the next question.
Any ideas?
I would wager this is not a question on a stumbling block of development but rather more a job spec in the real world. have you enough experience with Unity to get going on it or have little to none but would at least like to know a logical approach to tackling the JOB at hand.
Not that it is a s$$anonymous$$dfast rule persay, but this forum is best when there is a specific issue that you cannot get past and the expertise here will help you see yourself through or explain what may be unfamiliar as you enter different territories of development in Unity, hence: This is a job spec, a high level request that I would expect a client to come to me with.:) I am happy to give you a layout of approach, maybe a set of high level steps (algorithm) to start you off if you like. Let me know, but ulitmately, the task at hand is simple, it will come down to validation over most things because there is no guarantee of the input for any individual using it. Say I put in the word $$anonymous$$adRid and you were checking for a string that had $$anonymous$$adrid in it for example. a solution might be to uppercase all input and validate against the uppercase conversion of user input. It fairly straight forward in the code, depending on amount of words to validate etc. If lots, then i'd go REGEX the input strings, but thats a whole party of its own too :) Sorry if this has been unhelpful and someone may go further at this stage but generally, you have just put up a really high level idea. - or in other terms, a concept. :)
Hi Gruffy,
First of all, thank you so much for taking the time to respond.
To be honest I'm a rookie in this world of developing games or apps and C# or scripting is the hardest thing for me right now since I never studied it.
When I posted this question I had the hope that maybe there was an easy script of solution within Unity itself that could solve my problem. I didn't mean to be disrespectful to any professional like yourself or to anybody and I'm sorry if this is not the right place for this question.
I guess I was being naif thinking that at this point of the history of games and apps this problem had been solved for a long time with an easy script.
Once again, thank you for your kind explanation or my real situation.
[" I didn't mean to be disrespectful to any professional like yourself or to anybody and I'm sorry if this is not the right place for this question."] Oh no, you got me wrong, no disrespect was taken or inferred from your Question, just saying it looked more like a high level request or concept. I asked if you had any experience to clarify where we can go from here. With respect to script being written already, the answer is likely yes (or something very close and needs adapting). We do all think in this day and age that answers should be instantly achievable (on the proverbial silver platter too) and just waiting for us to find it, however, this is a result of a democratised knowledge-base... cos internet and all that. Which is great, but often leads us to think the answer is waiting for us rather than accepting sometimes, just sometimes, the journey is what you might need, as opposed to just the answer. It takes one thing to import a script, its another thing to understand why and how it does what it does, and change it for your own purposes on top. But hey I'm here to help with that, if I can, in any way. Cheers ears :) Gruffy
https://www.youtube.com/watch?v=j2j1Ui4B944 must watch and know how to write a script till the end
@decentboy113 We can only hope the op is able to speak (or learn in) Urdu :)
What is the Question? Start to work and ask if u are stucked.
Btw. This stuffs I recommend to use : SQLite4Unity3D
https://github.com/codecoding/SQLite4Unity3d
It will handle ur database for your lot of question and answer.
You will need a UI what is fit for your idea. Standars Unity stuffs are enought I think. And a simple GameController which is handling the data from the database, controlling your UI, and decide about answers.
Have Fun^^
That's my problem Geriko, I got stucked at the very beginning.
I created a very simple main menu for my game with Play, Settings and Quit buttons and one I click on Play it takes me to the first question "What's the capital of Spain?". I have a Inputfield where the player can type in the answer but I don't know how to create a script that would make the player go to the next question or stay in the same one, depending on if the answer is the right one or not. $$anonymous$$ake sense?
Thanks for your help
Answer by Gruffy · Apr 29, 2018 at 05:57 PM
Okay, so after discussing it above, here a starting point to work towards your Answer.
It has two buttons, one to start the game, the other to invoke a check on the answer in the input field.This may not be what you want towards the end but its a start... The text field in the middle is populated with a quick question but we will later take advantage of storing string fields that can be written in inspector for the managing object script attached. This is basic and starter level, it will need further refinement and features completion. It is however, a starting block for us to get you moving along.
Package no here must be zipped to be able to share them, you will need to unzip the package, open Unity and then import it. I suggest for testing purposes, you make a new Unity Project so you can keep this separate and integrate into your project where and when needed then. :) Questionable :)
So... This is the starting block, welcome :) I have coded the early functionality you need for your system. It currently can do one question and return a correct or incorrect text to you . We need to make a number of changes to go forward. Going forward step one... take this open it up and then we may have to go into PM somehere/ somehow and have a more live conversation to take you through it and develop it.
EDIT second and final package added to complete question... Questionable Final
Gruffy, you are the man!!
You are going to laugh but I don't know why it doesn't let me import it. I'm working with a $$anonymous$$ac, would that affect the content? All I see is Exec files... :(
I'm sorry if I'm asking you too much.
Can't wait to see what you have done!
Okay. You need to download the zip file . use something like" archiver" or "stuff it" to extract the package (it is named Questionable.package) Put this package on your desktop Open Unity up and make a new project. Then move you Unity editor window over a little and drag the .package into Unity, there will be an import tab open up asking if you want to select some or all of the import-able objects. Choose all, or just click YES/O$$anonymous$$. The package should absolutely import fine, its likely the zip file exrtract with $$anonymous$$AC. Try that and get back asap if you can and let me know if that worked :)
It let me drag it into Unity but it doesn't let me work with them cause it says that I can only use apps from the App Store or known developers... I'm working on this to solve it. Give me some time, please!
Thank youuuu
Your answer
Follow this Question
Related Questions
How do I play gameobjects in my scene from one script / Script is not working 0 Answers
I'm trying to set a script to inactive 1 Answer
How do i make the player to walk to where the mouse cursor position was clicked ? 0 Answers
Unity/C#/MongoDB - attempt to read past the end of the stream? 0 Answers
How can i show the ui button only when pressing on the escape key ? 2 Answers