Current location: Hot Scripts Forums » Programming Languages » Perl » perl/cgi newbie. hangman.cgi script adding html-like code on web and other trouble


perl/cgi newbie. hangman.cgi script adding html-like code on web and other trouble

Reply
  #11 (permalink)  
Old 11-13-03, 08:51 AM
Arowana Arowana is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
HA! That scoring system is pretty cool, millenium! I like it! The script works pretty good, man! I see what you did for the default condition. Thanks. The script does start off properly with the "Let's Play Hangman" welcome screen, however, there is one little problem. If you then click on Start Game, you get:

Congratulations, your word was:
Your score was 0 of a possible 0 points.

"Play Again" button

Once again, if you then click the button the game finally starts and works perfectly. This code is very different and I will take a look to see if I can figure it out, but do you happen to know why it's doing that? It's a very similar problem to before. It seems to me that it's printing the "win" subroutine after the "enter" subroutine, but before the actual game is played. I think I see why, and have tried a few things to no avail.

My brain is doing a little better... LOL. We'll see how long it lasts today! I already tried removing the &win() from the first line of the if ($playing) statement, but that only gives me a compilation error. I've also replaced &win() with several other things to see what would happen. Nothing's working. Argh... No wonder I'm a hardware guy!

Thanks!

Chris

PS. I posted it at a new URL of http://www.bartlett-family.net/cgi-bin/hangman_new.cgi (underscore between "hangman" and "new") in case you want to see it in action!

Last edited by Arowana; 11-13-03 at 09:13 AM.
Reply With Quote
  #12 (permalink)  
Old 11-13-03, 02:08 PM
Millennium's Avatar
Millennium Millennium is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Arowana
HA! That scoring system is pretty cool, millenium! I like it! The script works pretty good, man! I see what you did for the default condition. Thanks. The script does start off properly with the "Let's Play Hangman" welcome screen, however, there is one little problem. If you then click on Start Game, you get:

Congratulations, your word was:
Your score was 0 of a possible 0 points.

"Play Again" button

Once again, if you then click the button the game finally starts and works perfectly. This code is very different and I will take a look to see if I can figure it out, but do you happen to know why it's doing that? It's a very similar problem to before. It seems to me that it's printing the "win" subroutine after the "enter" subroutine, but before the actual game is played. I think I see why, and have tried a few things to no avail.

My brain is doing a little better... LOL. We'll see how long it lasts today! I already tried removing the &win() from the first line of the if ($playing) statement, but that only gives me a compilation error. I've also replaced &win() with several other things to see what would happen. Nothing's working. Argh... No wonder I'm a hardware guy!

Thanks!

Chris

PS. I posted it at a new URL of http://www.bartlett-family.net/cgi-bin/hangman_new.cgi (underscore between "hangman" and "new") in case you want to see it in action!
Try this, in the sub PrintHeader find this line:

if(param('new_game')) {

and change it to this:

if(param('new_game') || param('start_game')) {

and see if that helps.
Reply With Quote
  #13 (permalink)  
Old 11-13-03, 02:24 PM
Arowana Arowana is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
That DID it! I didn't even think to look into the PrintHeader subroutine. Argh! Very cool. This forum is awesome, and so are you. God, I am elarning so much. I understand so much better now. Thanks a million, millenium!

Chris
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 04:45 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.