• Welcome to The Cave of Dragonflies forums, where the smallest bugs live alongside the strongest dragons.

    Guests are not able to post messages or even read certain areas of the forums. Now, that's boring, don't you think? Registration, on the other hand, is simple, completely free of charge, and does not require you to give out any personal information at all. As soon as you register, you can take part in some of the happy fun things at the forums such as posting messages, voting in polls, sending private messages to people and being told that this is where we drink tea and eat cod.

    Of course I'm not forcing you to do anything if you don't want to, but seriously, what have you got to lose? Five seconds of your life?

Free Quiz From Butterfree not showing

Shiny Grimer

Active member
Pronoun
she/her, they/them
I went to the free quiz script part of the site, followed Butterfree's instructions to the letter, but the image won't show up.

I'm using the asp version.
Here is check.asp
Code:
<%@ language=JScript %>
<html>
<head>
<title>Critter Cryptics: The Result</title>
</head>
<body>
<%   var result;

   function check()
   {
      var question;
      var modest;
      var outgoing;
      var serious;
      var notserious;
      var result;
      var choice;
      var modest_outgoing;
      var serious_notserious;
   
      question = 1;
      modest = 0;
      outgoing = 0;
      serious = 0;
      notserious = 0;
      result = "";
      modest_outgoing = 0;
      serious_notserious = 0;

      for (question = 1; question <= 10; question++) {
         choice = Request.Form("q" + question.toString());
            if (choice == "modest") {
               modest++;
            }
            if (choice == "outgoing") {
               outgoing++;
            }
            if (choice == "serious") {
               serious++;
            }
            if (choice == "notserious") {
               notserious++;
            }
         }
      modest_outgoing = modest - outgoing;
      serious_notserious = serious - notserious;
      if (modest == 0 && outgoing == 0 && serious == 0 && notserious == 0) {
         // the user hasn't taken the quiz
         result = "oops";
      }
      else if (modest_outgoing > 0 && serious_notserious > 0 && modest > serious) {
         // mainly modest, also serious
         result = "earthbound64";
      }
      else if (modest_outgoing > 0 && serious_notserious > 0 && serious > modest) {
         // mainly serious, also modest
         result = "pkmnrb";
      }
      else if (modest_outgoing > 0 && serious_notserious > 0 && serious == modest) {
         // serious and modest equally
         result = "mother3";
      }
      else if (modest_outgoing > 0 && serious_notserious < 0 && modest > notserious) {
         // mainly modest, also notserious
         result = "pkmngs";
      }
      else if (modest_outgoing > 0 && serious_notserious < 0 && notserious > modest) {
         // mainly notserious, also modest
         result = "smrpg2";
      }
      else if (modest_outgoing > 0 && serious_notserious < 0 && notserious == modest) {
         // notserious and modest equally
         result = "pkmny";
      }
      else if (modest_outgoing < 0 && serious_notserious > 0 && outgoing > serious) {
         // mainly outgoing, also serious
         result = "pkmndp";
      }
      else if (modest_outgoing < 0 && serious_notserious > 0 && serious > outgoing) {
         // mainly serious, also outgoing
         result = "spm";
      }
      else if (modest_outgoing < 0 && serious_notserious > 0 && serious == outgoing) {
         // serious and outgoing equally
         result = "pokemonp";
      }
      else if (modest_outgoing < 0 && serious_notserious < 0 && outgoing > notserious) {
         // mainly outgoing, also notserious
         result = "pkmnc";
      }
      else if (modest_outgoing < 0 && serious_notserious < 0 && notserious > outgoing) {
         // mainly notserious, also outgoing
         result = "pkmne";
      }
      else if (modest_outgoing < 0 && serious_notserious < 0 && notserious == outgoing) {
         // notserious and outgoing equally
         result = "earthbound";
      }
      else if (modest_outgoing == 0 && serious_notserious > 0) {
         // neutral modest/outgoing, serious
         result = "smrpg";
      }
      else if (modest_outgoing == 0 && serious_notserious < 0) {
         // neutral modest/outgoing, notserious
         result = "pmttyd";
      }
      else if (modest_outgoing > 0 && serious_notserious == 0) {
         // neutral serious/notserious, modest
         result = "earthbound0";
      }
      else if (modest_outgoing < 0 && serious_notserious == 0) {
         // neutral serious/notserious, outgoing
         result = "papermario";
      }
      else if (modest_outgoing == 0 && serious_notserious == 0) {
         // neutral
         result = "pkmnrs";
      }
      else {
         // no result found
         result = "oops";
      }
      }
   check();

%>

<img src="http://www.freewebs.com/crittercryptics/<%=result%>.png">
<p>HTML:</p>
<textarea rows="3" cols="25"><a href="http://URL.to.quiz"><img src="http://www.crittercryptics.com/Images/<%=result%>.png"></a></textarea>
<p>BBCode:</p>
<textarea rows="3" cols="25">[url=http://URL.to.quiz][img]http://www.crittercryptics.com/Images/<%=result%>.png[/img][/url]</textarea>

</body>
</html>

The quiz is at www.crittercryptics.com/quiz.shtml

When I am supposed to get my result, no image shows up. The
Code:
<img src="http://www.freewebs.com/crittercryptics/<%=result%>.png">
part just shows <img src="http://www.freewebs.com/crittercryptics/.png"> and I get a broken image.

I really don't know what happened. I'm using GoDaddy for my host which supports ASP.net. I figured ASP and ASP.net were similar enough for the thing to work. Is that the problem?
 
Why are your images on Freewebs instead of your own server? I'm not sure that that's the problem (I want to say that Freewebs doesn't allow direct linking to images but I could very well be wrong), but...?
 
My own website hates me.
I can't host them there because they don't show up for whatever reason.
It didn't work with Photobucket either. It remains <img src="photobucket.balababla.../.png">

The problem is that <%result> doesn't work and leaves the filename blank. That image doesn't exist, so it doesn't work.
 
<%result> isn't the name of your image, is it? If it's not, you probably need to change it to pikachu.png or whatever the image name is. Actually, I don't think you can name files with <, %, or >.
 
Look at this:
http://dragonflycave.com/freequiz.aspx#extreme

That's where I got the code and stuff from. For the ASP, it says <img src="<%=result%>.gif">
<p>HTML:</p>
<textarea rows="3" cols="25"><a href="http://URL.to.quiz"><img src="http://your.image.URL/<%=result%>.gif"></a></textarea>
<p>BBCode:</p>
<textarea rows="3" cols="25"></textarea>

The <%result%> is so that if you get the result of Makuhita, it puts makuhita in there and that'syour picture, and if you get a Shedinja, you get a Shedinja etc. It's an asp thing.
 
I thought the problem to be var result not defined, but it is.

Thus, I have no idea what is wrong with the script.

A possible solution would be to use the JS version of the script.
 
Try some generic debugging, e.g. check whether the check() function is running at all, etc. (by adding a line in the function somewhere that prints "Hello world" or something, for instance).
 
;_; I really don't know that much about ASP, so I don't know what you mean by generix debugging. I put <%="Hello World"%> in the image thing so that when I finished the test, the image URL was blabla.com/Hello World.png, but since the quatation marks make it exact, putting result in quotation resulted in unchanging result.png.

I did the whole test over again to see if I copied it wrong, but no. Same thing. ACtually, now the page won't show up.

I took a look at a book my dad had on ASP and ASP.net. The former is from 1997 and wasn't of much help. The latter was from 2003 and I thought I could do something with request.form ("stuff") but then I realized I didn't know what I was requesting from. i'm such an idiot

I really want to see if I can make the ASP one because more Javascript in my left.txt makes the page look ugly and with the ASP, the source looks nice and clean (you can't see it on a browser, can you?). If it's really bad, I could try the javascript one but I'm hoping for a solution before I have to do that. :_;
 
As I said, put Response.Write("Hello world!"); as the first line after function check() { and see what happens.
 
Ha ha I suck at this.

Microsoft JScript compilation error '800a03f0'

Expected '{'

/check.asp, line 9
function check()Response.Write("Hello world!");
----------------^

That was in opera (I put a space after () and it still did the ---^ thing). Internet Explorer 7 decided the page was evil and declared error HTTP 500.
 
Ah, I feel stupid now.
It displays Hello World! before the broken image. I don't know what this means; presumably the function is running?
If that works, is it possible to put instead of result = "oops", Response.Write("oops");? I guess not because it wouldn't put it in the filename of the image.
 
Yes, that means the function is running.

Try putting Response.Write(modest_outgoing); at the end of the function.
 
I think I put it right this time. I put it before the last bracket:
Code:
      }
      Response.Write(modest_outgoing);}
   check();

%>

It gives me a number before the image which I guess is the score for modest_outgoing. Same thing happened with serious_notserious (of course it gave a different number).
 
Okay, then the function is running just fine. Try making that into Response.Write(result);?
 
Hmm, try changing <%=result%> to <% Response.Write(result) %>.
 
Ah, that doesn't work either. It still displays the image as broken and the code says "photobucketbla.com/.png".
I thought that changing the results to <img src=" www.blabla.com/eb0.png"> or something would work but it didn't work.
 
...oh, hey, I know what's wrong. You've got this line in twice, both at the very beginning and inside the function:

Code:
var result;

Remove the one inside the function. I'll be very surprised if it doesn't work then.
 
*yes* It works. :D I was ready to rip my hair out and just let it say the name. Thank you for helping me make my stupid quiz work. I don't know how that extra var result; came to be there, but it's gone now. I'm so happy that it finally works. Once again, thank you for the help. :] *more glad things go here*
 
Back
Top Bottom