So, I'm trying to make a hangman game spin-off. I need the basic engine. I have a list that has the letters of the word (each entry is one letter), a list that starts out with those letters replaced by _, and a variable that outputs the latter list. I'll be posting the script later, but I can't ATM. If you can suggest things now, go ahead. Project
Last edited by Firedrake969 (2013-01-05 18:58:11)
Offline
Firedrake969 wrote:
So, I'm trying to make a hangman game spin-off. I need the basic engine. I have a list that has the letters of the word (each entry is one letter), a list that starts out with those letters replaced by _, and a variable that outputs the latter list. I'll be posting the script later, but I can't ATM. If you can suggest things now, go ahead.
well you could check out my Hangman 0s1s for inspiration, i am not quite sure it is totally what you are looking for but it is a start
Last edited by Willpower (2013-01-05 03:34:58)
Offline
Willpower wrote:
Firedrake969 wrote:
So, I'm trying to make a hangman game spin-off. I need the basic engine. I have a list that has the letters of the word (each entry is one letter), a list that starts out with those letters replaced by _, and a variable that outputs the latter list. I'll be posting the script later, but I can't ATM. If you can suggest things now, go ahead.
well you could check out my Hangman 0s1s for inspiration, i am not quite sure it is totally what you are looking for but it is a start
Thanks! Can you comment out the code for me? I uploaded the project, it's in the OP.
Last edited by Firedrake969 (2013-01-05 18:55:49)
Offline
Or, you could look at my hangman game http://scratch.mit.edu/projects/BoltBait/463279
Last edited by BoltBait (2013-01-06 15:31:41)
Offline
when gf clicked set [word v] to (item (any v) of [wordbank v]) set [i v] to [1] repeat (length of (word)) add (letter (i) of (word)) to [current word v] change [i v] by [1] end repeat until <<(wrong letters) = (total chances)> or <(length of [current word v] = (0)>> if <input recieved>//you need your own system here if <[current word v] contains (input)> set [i v] to [1] repeat (length of (word)) if <(item (i) of [current word v]) = (input)> delete (i) of [current word v] else change [total chances v] by [-1] endObviously the input needs to be put in by a sprite reaction or a question, and this needs a visual output, but it's the coding behind it
Offline
zammer990 wrote:
when gf clicked set [word v] to (item (any v) of [wordbank v]) set [i v] to [1] repeat (length of (word)) add (letter (i) of (word)) to [current word v] change [i v] by [1] end repeat until <<(wrong letters) = (total chances)> or <(length of [current word v] = (0)>> if <input recieved>//you need your own system here if <[current word v] contains (input)> set [i v] to [1] repeat (length of (word)) if <(item (i) of [current word v]) = (input)> delete (i) of [current word v] else change [total chances v] by [-1] endObviously the input needs to be put in by a sprite reaction or a question, and this needs a visual output, but it's the coding behind it
Ok. This does work; however, I have a list that has _ for each letter in each list entry, and it gets replaced by the letter if you guess it. How should I do that?
Offline
firedrake969_test wrote:
Ok. This does work; however, I have a list that has _ for each letter in each list entry, and it gets replaced by the letter if you guess it. How should I do that?
replace item (i) of [other list v] with (item (i) of [current word v])put that in before the delete command
Last edited by zammer990 (2013-01-07 13:02:38)
Offline
zammer990 wrote:
firedrake969_test wrote:
Ok. This does work; however, I have a list that has _ for each letter in each list entry, and it gets replaced by the letter if you guess it. How should I do that?
replace item (i) of [other list v] with (item (i) of [current word v])put that in before the delete command
One thing, not sure if it works for multiple letters. Say the word is "letters", would it delete both e's?\
EDIT: This doesn't work, shall I upload project?
Last edited by firedrake969_test (2013-01-08 12:35:02)
Offline
firedrake969_test wrote:
zammer990 wrote:
firedrake969_test wrote:
Ok. This does work; however, I have a list that has _ for each letter in each list entry, and it gets replaced by the letter if you guess it. How should I do that?
replace item (i) of [other list v] with (item (i) of [current word v])put that in before the delete commandOne thing, not sure if it works for multiple letters. Say the word is "letters", would it delete both e's?\
EDIT: This doesn't work, shall I upload project?
It ought to get rid of all letters that are the same, since it iterates through. Sure upload it.
Offline
zammer990 wrote:
firedrake969_test wrote:
zammer990 wrote:
replace item (i) of [other list v] with (item (i) of [current word v])put that in before the delete commandOne thing, not sure if it works for multiple letters. Say the word is "letters", would it delete both e's?\
EDIT: This doesn't work, shall I upload project?It ought to get rid of all letters that are the same, since it iterates through. Sure upload it.
Uploading.
http://scratch.mit.edu/projects/firedrake969_test/3021624
Offline
Firedrake969 wrote:
zammer990 wrote:
firedrake969_test wrote:
One thing, not sure if it works for multiple letters. Say the word is "letters", would it delete both e's?\
EDIT: This doesn't work, shall I upload project?It ought to get rid of all letters that are the same, since it iterates through. Sure upload it.
Uploading.
http://scratch.mit.edu/projects/firedrake969_test/3021624
Well, initially, the code for checking the letter against the letters of word was outside the repeat loop, put it after you add the letter to "letters used:", secondly, you don't seem to have a way to win, since even if you get all the letters it just asks for more(but I suppose it's still and early build), and finally, "C" as a hangman word?!
Offline
zammer990 wrote:
Firedrake969 wrote:
zammer990 wrote:
It ought to get rid of all letters that are the same, since it iterates through. Sure upload it.Uploading.
http://scratch.mit.edu/projects/firedrake969_test/3021624Well, initially, the code for checking the letter against the letters of word was outside the repeat loop, put it after you add the letter to "letters used:", secondly, you don't seem to have a way to win, since even if you get all the letters it just asks for more(but I suppose it's still and early build), and finally, "C" as a hangman word?!
Can you upload it as a remix and I'll check the code?
C is a programming language. xD
Offline
firedrake969_test wrote:
zammer990 wrote:
Firedrake969 wrote:
Uploading.
http://scratch.mit.edu/projects/firedrake969_test/3021624Well, initially, the code for checking the letter against the letters of word was outside the repeat loop, put it after you add the letter to "letters used:", secondly, you don't seem to have a way to win, since even if you get all the letters it just asks for more(but I suppose it's still and early build), and finally, "C" as a hangman word?!
Can you upload it as a remix and I'll check the code?
C is a programming language. xD
I know C is a lamguage, it's just a rather easy (hard?) word.
http://scratch.mit.edu/projects/zammer990test/3029871
Offline
When I try to import it into a different project, the lists won't show up...
Offline
zammer990 wrote:
firedrake969_test wrote:
When I try to import it into a different project, the lists won't show up...
they ought to, and when I played through it offline it worked fine
I re-uploaded. Test it out.
It has the same everything.
Darn 60 second rule.
Offline
firedrake969_test wrote:
zammer990 wrote:
firedrake969_test wrote:
When I try to import it into a different project, the lists won't show up...
they ought to, and when I played through it offline it worked fine
I re-uploaded. Test it out.
It has the same everything.
Darn 60 second rule.
It worked for me, put in a few letters, got a single word, the word was c, pressed c, it finished the word, but had no finish code
Offline
zammer990 wrote:
firedrake969_test wrote:
zammer990 wrote:
they ought to, and when I played through it offline it worked fine
I re-uploaded. Test it out.
It has the same everything.
Darn 60 second rule.It worked for me, put in a few letters, got a single word, the word was c, pressed c, it finished the word, but had no finish code
Really? Can't think of anything ATM, but something will come to me.
Last edited by Firedrake969 (2013-01-10 19:45:16)
Offline
Firedrake969 wrote:
zammer990 wrote:
firedrake969_test wrote:
I re-uploaded. Test it out.
It has the same everything.
Darn 60 second rule.It worked for me, put in a few letters, got a single word, the word was c, pressed c, it finished the word, but had no finish code
Really? Can't think of anything ATM, but something will come to me.
for a finish, use this
if <not<[inputword v] contains [--]>> finishing text/pick new word
Last edited by zammer990 (2013-01-11 06:06:43)
Offline