Author Topic: Hangman for Lua  (Read 11847 times)

0 Members and 1 Guest are viewing this topic.

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Hangman for Lua
« on: December 23, 2011, 01:32:09 pm »
I have recently created a Hangman program with Lua for the Nspire. This is my second Lua Project, the first has yet to be released. Right now, I have over 100 words in the dictionary with categories. I plan to add two-player and possibly better sprites for the hangman.

I would share a screenshot on here or a download, but how do you do that?  ???
Additionally, how do you do an animated screenshot?

Thanks in advance!

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Hangman for Lua
« Reply #1 on: December 23, 2011, 01:38:42 pm »
nice project, finally a hangman with words :)
and two player would be very nice.. does the one-player version already work totally?

well, my way isn't the way it should be done, but it works:

i use autoscreenrecorder to take an avi screenshot (so a movie)
and then i convert it with avi to gif converter

this results in colored animated screenshots, but they are sometimes "shocky" (low framerate)
« Last Edit: December 23, 2011, 01:39:31 pm by Nick »

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Hangman for Lua
« Reply #2 on: December 23, 2011, 02:10:48 pm »
I think the one-player should be totally working, but I haven't tested all of the words. Drawing, lives, all that is done.

For the screenshots, how do you use the img tags to attach a picture on here? Sorry if it wasn't clear before.

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Hangman for Lua
« Reply #3 on: December 23, 2011, 02:14:18 pm »
well, you upload it to removed from game and then copy the second link (the one with the [.img.]URL[./img.] but without those periods, those are to make it not look like the tags in here) and then just past it in here and you should be fine
« Last Edit: December 23, 2011, 02:15:34 pm by Nick »

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Hangman for Lua
« Reply #4 on: December 23, 2011, 02:17:46 pm »
Hangman's a great idea!

To post images type

[img]http://image url[/img]
or
[img width=number height=number]http://image url[/img]


A good reference for bbcode is http://www.omnimaga.org/index.php?action=help;page=post

If you need ideas for more words you can look here: http://dictionary-thesaurus.com/wordlists.html
It has tons of words broken down into categories.
« Last Edit: December 23, 2011, 02:21:17 pm by 3rik »
Userbars

Offline Loulou 54

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 165
  • Rating: +39/-0
    • View Profile
    • Mes programmes sur TI bank.
Re: Hangman for Lua
« Reply #5 on: December 23, 2011, 04:03:53 pm »
Woow you gave me an idee !

I'm making a translator on calc, in Lua.
It could be fine to join a hangman game, since I have more than 50 000 words either in english or in french !! :)

Maybe I could integrate your program into my translator, when you have finished it, if you agree ?
Some of my program available here.. :)
http://ti.bank.free.fr/index.php?mod=archives&ac=voir2&id=1471

     

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Hangman for Lua
« Reply #6 on: December 23, 2011, 04:16:24 pm »
@3rik - Thanks for the guide! I should've read that.

@Loulou - That would be absolutely insane to have 50,000 words! I've read the page about your translator and it would be an honor to integrate my humble program into yours. It should be pretty easy to add words in.

@Nick - I remember that was down for a bit, but it's back up. Thanks!

Here are some screenshots:



The screenshots are a bit big  :P

I've also included the .tns and source. Please keep in mind I created this in two days and more features/improvements are going to be added. The program is actually pretty small, only about 250 lines.

Offline Loulou 54

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 165
  • Rating: +39/-0
    • View Profile
    • Mes programmes sur TI bank.
Re: Hangman for Lua
« Reply #7 on: December 23, 2011, 04:46:52 pm »
Nice ! :)

Maybe you could add difficulty levels. ;)
Keep us aware of the progress, if you add some features !
I will be pleased to adapt it in my project. :)

I will have to adapt it to my data base, (I can not make categories though..) and to add a language choice. (french, english or both.) :)
Some of my program available here.. :)
http://ti.bank.free.fr/index.php?mod=archives&ac=voir2&id=1471

     

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Hangman for Lua
« Reply #8 on: December 23, 2011, 08:45:32 pm »
looks great! and it would be nice if those two projects were merged to one nice program..

Offline Loulou 54

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 165
  • Rating: +39/-0
    • View Profile
    • Mes programmes sur TI bank.
Re: Hangman for Lua
« Reply #9 on: December 24, 2011, 09:31:47 am »
looks great! and it would be nice if those two projects were merged to one nice program..
I think I'll put the hangman game in a second "tab". (I mean the 1.1, 1.2,... stuffs) It would be ok I think, and easier than integrate the hangman in my script.. :)
Some of my program available here.. :)
http://ti.bank.free.fr/index.php?mod=archives&ac=voir2&id=1471

     

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Hangman for Lua
« Reply #10 on: December 24, 2011, 10:06:37 pm »
Well, being Christmas Eve and all, didn't code too much. I just added a function that allows the user to press the enter key after gameover so they can figure out what word it was. I personally like figuring out what word I was trying to guess. I'll work on two-player later. Two-Player is just one person creating a word for the other person. I could make it more advanced later, like two words, and the two people take turns guessing.

I will add difficulty levels very soon and some more tricky/easy words.

As another question, one of my "beta testers" (my brother) wants me to change "cesium" to "caesium". Opinions?  :)

Loulou 54 - How would you input letters with accents? And as a side note, how do you get a second tab for the Lua program?

Happy Holidays everyone!

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: Hangman for Lua
« Reply #11 on: December 24, 2011, 10:24:44 pm »
This actually looks pretty good! I think I might do this for TI 80's
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline Loulou 54

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 165
  • Rating: +39/-0
    • View Profile
    • Mes programmes sur TI bank.
Re: Hangman for Lua
« Reply #12 on: December 25, 2011, 01:19:27 pm »
Loulou 54 - How would you input letters with accents? And as a side note, how do you get a second tab for the Lua program?

There is two ways : you can type it through the "char-catalog", but the most user friendly is to use the little flag key after the letter you want to accentuate. It works even in a Lua script. :) (but here, it's a bit more difficult because the program reacts directly after the key press.)
But in a hangman game, the player doesn't have to guess the accents. He only has to type "e" and the "é", "è", "ê" are recognized normally.
So you should try to recognize that a "é" is discovered when pressing "e".. ^^
(if you have time and desire to do it) :thumbsup:

An advice : I don't know what tools you use, but generally if you type an accentuated character in your source code it will produce strange bugs like close immediately the student software..
So, each time you have to put an accentuated character in your code, use the string.uchar(...) function with the code of the character you want.
And if you want to have the code of a character, for example "é" use the function ord("é") on the calculator.

So you know this problem now and you won't be surprised if it occurs..  8)
I have been very annoyed because of that...

Good luck !
Some of my program available here.. :)
http://ti.bank.free.fr/index.php?mod=archives&ac=voir2&id=1471

     

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Hangman for Lua
« Reply #13 on: December 26, 2011, 08:41:24 pm »
Well, difficulty has been added, currently working on two player. Have added some words for more very easy/tricky words.

How would you guys do letter spacing? I thought about concatenating the word as a string, but one of my fellow 84 programmers pointed out that the letters would constantly move. I could always make it have more space, but that means shorter words. Is there a fixed width font for the Nspire?

Tools I use -
IDE - Notepad++
Testing - Nspire CX CAS Software + oclua
Compilation? - Luna v0.2b
Consultation - Inspired-Lua and Omnimaga

Edit: 2 Player Done!
« Last Edit: December 26, 2011, 09:10:04 pm by cyanophycean314 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Hangman for Lua
« Reply #14 on: December 27, 2011, 01:07:51 am »
Seems pretty nice. As for uploading, you can put it in Omnimaga archives (although I'm unsure if you needed 40 posts or 20 for that). Otherwise there's Ticalc.org and Ti-Planet (French). If you want to upload directly in a post, click Reply and there should be an upload form below where you type text now. Your game might get lost with the other posts and topics eventually, though, so it's always good to upload it in an archive.