Alice Community  

Go Back   Alice Community > Alice 3 > How Do I?

Reply
 
Thread Tools Display Modes
How to save user word input (string) to make score?
Old
WinterIsComing
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2020
Default How to save user word input (string) to make score? - 10-15-2020, 04:40 PM

[SOLVED]

This is not for a school project. I use Alice as a hobby and the current "home" project I'm doing is for a family online experience (due to COVID remote distancing). That said, I set up a theme where a character asks my nephew to put his user input after being asked a question (in which the character will respond with being incorrect or correct). However, the user input is a string and not an integer. This is where I'm having some confusion.

How do I have the program "store" or save my nephew's word, not interger, answer to calculate for a score at the end of the animation?

So far, I made a list of appropriate global scene variable textstrings that are the words of the name of the objects in my animation. Basically he is being asked ot name the objects in the animation.

I have a proper:

If *getstringfromuser* "Question" *equalsignorecase* this."__" Then this character says "Good job!" else "Incorrect!" statement"

I have all my questions and If Then statements setup and my character responding with the appropriate response, but I don't know how to keep track of the correct answers to create a score or total in the end.

Last edited by WinterIsComing; 10-16-2020 at 10:52 AM. Reason: Problem was solved
   
Reply With Quote
Scoreboard for Games
Old
djslater107
Administrator
 
Status: Online
Posts: 163
Join Date: Jan 2007
Default Scoreboard for Games - 10-16-2020, 08:22 AM

Here is a link to a .pdf of a set of Powerpoint slides that describe how to create a scoreboard from an Alice text object (I am assuming you are working in Alice 2 - let me know if you need this information for Alice 3, although the principles are very close, or if you have problems with the link).

https://www.dropbox.com/s/tjhim81gku...rd%20.pdf?dl=0

In the slides, the score is increased when the cow is clicked on with the mouse. In your case, you would increase the score when a correct answer is given in the if statement.

Let me know if you have any other questions.

Don Slater
Alice Project

don@alice.org


Don Slater
Alice Team
Carnegie Mellon University
   
Reply With Quote
Old
WinterIsComing
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2020
Default 10-16-2020, 08:47 AM

Quote:
Originally Posted by djslater107 View Post
Here is a link to a .pdf of a set of Powerpoint slides that describe how to create a scoreboard from an Alice text object (I am assuming you are working in Alice 2 - let me know if you need this information for Alice 3, although the principles are very close, or if you have problems with the link).

https://www.dropbox.com/s/tjhim81gku...rd%20.pdf?dl=0

In the slides, the score is increased when the cow is clicked on with the mouse. In your case, you would increase the score when a correct answer is given in the if statement.

Let me know if you have any other questions.

Don Slater
Alice Project

don@alice.org


I am working with Alice 3.6. I love the scorekeeper idea but unfortunately, my sister (his mother) wants me to show him the game using a more challenging approach to the coding. The goal is once I have his scores added up for a "grand total", I have the animation tell him his percentage (to simulate granting a grade) based on the total correct out of the number of questions. An exception to this would be I assume, that the score keeper method can be used to do the same thing? Add up all the scores to give a total percentage from how many problems right? Thank you for your response.
   
Reply With Quote
Solved
Old
WinterIsComing
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2020
Default Solved - 10-16-2020, 10:51 AM

Nevermind, I solved the issue!

I added these codes



   
Reply With Quote
use of variables
Old
djslater107
Administrator
 
Status: Online
Posts: 163
Join Date: Jan 2007
Default use of variables - 10-16-2020, 12:31 PM

I am going to assume that you are riding this myFirstMethod...

Create two variables in myFirstMethod, by dragging the variable tile at the bottom of the screen to the beginning of myFirstMethod.

1) set the valueType of each to DecimalNumber
2) name one attempts, and the other correct
3) set the initializer value of each 0.0

Every time that a question is displayed, increase the attempts variable by 1
1) drag the assign tile into the appropriate place in your code
2) select attempts -> attempts from the menu that appears
3) click on the attempts tile on the right-hand side of the <- operator
4) from the drop-down menu select Math
5) from the submenu that appears select attempts + ???
6) from the next submenu select 1.0

Repeat this process for the correct variable in the appropriate part of your code

After you have finished asking all the questions.

Create another variable, results, and store the correct / results value

Then display this results variable as part of a say statement

Let me know if you have any more questions.

All the best,
Don Slater


Don Slater
Alice Team
Carnegie Mellon University
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.