To be honest, this wasn't my first LiveCode dream, but it made for a good title for a blog posting. I dreamt of a great mobile app that could be done easily in LiveCode. I actually worked out a very interesting design and I awoke feeling like I had come up with a great idea. The app would hold all of one's various user names and passwords. I even thought of an interesting way to "encrypt" these data so that what would be revealed on the mobile device screen would be safe from "prying eyes." For example, an option would be to show just the first letter and any numbers. So, a password such as "Password18" would appear as "P*******18", enough to remind the user of the particular password.
But alas, my hope of stumbling on an app idea that would make a million dollars was quickly dashed when I did a search in the Apple App store and found a multitude of apps that do this very thing. And, they all had much more creative options and features than the design that emerged from my dream. For example, most include something they called "military style encryption," which I'm pretty sure is a tad more sophisticated than what I described above. Each seems to also have the capability to go and log the user in to each of the respective Websites.
Oh well. But, I think I will go ahead and create a little file that uses some basic list processing commands of LiveCode to do the "encryption" idea above. It sounds like an interesting little project. Check back later for the code.

This blog is about learning LiveCode to create interactive software for education. The main focus is on creating educational games, simulations, and microworlds. However, discussion of other software designs is not off limits. The focus is squarely on me learning LiveCode and sharing what I've learned, but if others learn something too, then all the better. I also hope those with more skill than I will share their expertise with me.
Thursday, February 7, 2013
Random Name Chooser
I'm teaching a course this semester that introduces graduates to research methods. One of the fundamental concepts is random assignment, that is, randomly choosing people from a pool of participants to some research condition or activity. To have a little fun while also modeling this simple, yet very important idea, I had put everyone's name on a slip of paper, then folded each and placed them in a Pittsburgh Steeler hat -- a literal example of then drawing a name from the hat each week for some "lucky" individual to give the rest of the class his/her interpretation of an assigned reading or podcast.
This week I decided to shift to an electronic means of choosing one of the class members at random. So, I created a small LiveCode project that does just that. I originally intended to just take 2 minutes to create a stack that simply selected a number at random, corresponding to the total number of people in the class. But, I thought I would have a little fun by creating a tool that allowed me to enter all of the names of the individuals into a text field, and then have LiveCode choose and display one of the names at random. This took about 10 minutes.
I took another 20 minutes to add just a little pizzazz to the file (though "pizzazz" is most likely much too strong a word.) I wanted to add a little suspense, so I added code that gave the impression that the software was running through the names -- fast at first, then ever more slowly -- before narrowing it down to the "winner." Kinda like a wheel spinning (though there are no graphics in this file). Then, the chosen name is animated to the center of the screen. You can have as many or as few names as you wish -- the code first counts how many names are in the text field.
All of this code is in the button "Choose":
on mouseUp
hide me
put the number of lines in field "names" into varNumber
put 1 into varDelay
put "Spinning the wheel." into line 1 of field "comment"
repeat 25 times
put the random of varNumber into varWinner
put line varWinner of field "names" into field "winner"
wait varDelay ticks
add 1 to varDelay
put "." after line 1 of field "comment"
end repeat
put "And the winner is..." into line 1 of field "comment"
//move to center of screen
hide field "names"
move field "winner" to 203, 236 in 1 second without waiting
move field "comment" to 189, 192 in 1 second
hide field "title"
show button "Reset"
end mouseUp
varDelay is the timer -- it starts off at one tick (1/60 second), then adds one tick at each loop. So, by the end, it is pausing almost a half second. I'm also fond of the technique of adding a period to the end of a word or phrase to give the impression that the computer is "working," so I added that as well.
(All of the variables are local -- no need for any global variables.)
The button "Reset" does just that -- resets everything for the next choice.
There are many logical "next steps." For example, right now the file keeps all the names "in the hat," but it would be a relatively simple matter to have the name deleted from the text field after it is chosen. It would also be very cool to have a graphic of a wheel spinning with the names, but I confess to having no idea how to pull that one off. (I think I could manage a spinning wheel, but not one that pulls the names from the text field into each wheel wedge.)
Here it is a link to the file: random_name-Rieber.livecode
(I put in the names of the United States Presidents for this sample file, but you can substitute any names you like. Just be sure to put one name per line.)
This week I decided to shift to an electronic means of choosing one of the class members at random. So, I created a small LiveCode project that does just that. I originally intended to just take 2 minutes to create a stack that simply selected a number at random, corresponding to the total number of people in the class. But, I thought I would have a little fun by creating a tool that allowed me to enter all of the names of the individuals into a text field, and then have LiveCode choose and display one of the names at random. This took about 10 minutes.
I took another 20 minutes to add just a little pizzazz to the file (though "pizzazz" is most likely much too strong a word.) I wanted to add a little suspense, so I added code that gave the impression that the software was running through the names -- fast at first, then ever more slowly -- before narrowing it down to the "winner." Kinda like a wheel spinning (though there are no graphics in this file). Then, the chosen name is animated to the center of the screen. You can have as many or as few names as you wish -- the code first counts how many names are in the text field.
All of this code is in the button "Choose":
on mouseUp
hide me
put the number of lines in field "names" into varNumber
put 1 into varDelay
put "Spinning the wheel." into line 1 of field "comment"
repeat 25 times
put the random of varNumber into varWinner
put line varWinner of field "names" into field "winner"
wait varDelay ticks
add 1 to varDelay
put "." after line 1 of field "comment"
end repeat
put "And the winner is..." into line 1 of field "comment"
//move to center of screen
hide field "names"
move field "winner" to 203, 236 in 1 second without waiting
move field "comment" to 189, 192 in 1 second
hide field "title"
show button "Reset"
end mouseUp
varDelay is the timer -- it starts off at one tick (1/60 second), then adds one tick at each loop. So, by the end, it is pausing almost a half second. I'm also fond of the technique of adding a period to the end of a word or phrase to give the impression that the computer is "working," so I added that as well.
(All of the variables are local -- no need for any global variables.)
The button "Reset" does just that -- resets everything for the next choice.
There are many logical "next steps." For example, right now the file keeps all the names "in the hat," but it would be a relatively simple matter to have the name deleted from the text field after it is chosen. It would also be very cool to have a graphic of a wheel spinning with the names, but I confess to having no idea how to pull that one off. (I think I could manage a spinning wheel, but not one that pulls the names from the text field into each wheel wedge.)
Here it is a link to the file: random_name-Rieber.livecode
(I put in the names of the United States Presidents for this sample file, but you can substitute any names you like. Just be sure to put one name per line.)
Sunday, January 13, 2013
The Value of Field Testing
In my last post I said that I did not do any field testing of the game during development. This is not completely accurate. Soon after I began the project in June, 2012, my brother-in-law and his family came and visited us in Georgia. I had just come up with the idea of a "hotel on the moon" as the context for the simulation/game and was wondering if it was worth pursuing. Nick and Sophie, ages 10 and 7 respectively, seemed interested in the fact that I was working on "an app," Nick in particular. So, I told them my (half-baked) story about this and to my delight they found it very interesting, so much so that they enthusiastically began drawing some pictures for me. I included two of their pictures on a page in the Credits section where I thank Nick and Sophie for their help:
If Nick and Sophie had not found this story context interesting, you can be sure I would have scrapped the idea and come up with something else.
Side note: So far, this is the only place in the app where I have found a typo. Do you see it? (I left out the word "to.")
Subscribe to:
Posts (Atom)