Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Quiz Results

13 years ago

Okay, so I'm experimenting with quizzes and I'm trying to see how to do this certain thing (or if it's even possible).

So say you're taking a quiz and you're getting points for a certain personality based on your answers. Is there a way to make it so the computer knows which variable (say, happy) has the most points?

Quiz Results

13 years ago
I'm making this up, so I might be wrong... but...

Everytime they guess one that says they're happy, add 1 to a HAPPY variable. At the end do this:

IF %HAPPY > %SAD THEN
BEGIN
IF %HAPPY > %ANGRY THEN
BEGIN
IF %HAPPY > %NORMAL THEN
%MOST = 1
END
END

And, if you do that for all of the emotions you have, or whatever, it should work. In theory. It checks that its the greatest number of all the variables, and then assigns '1', which will stand for happy, to the MOST variable.

At the end, you'll want something that goes like this (assuming P2 is the page for happy, P3 is the page for sad, etc.)

IF %MOST = 1 THEN
$DEST := @P2
IF %MOST = 2 THEN
$DEST := @p3



etc...

understand?

Quiz Results

13 years ago

...ugh, dizzy...

Uh, sorta. I think if I make the quiz then fiddle around with this scripting I can kinda get the feel for it. thanks Z (but if you want to explain more via PM that would be appreciated).

Quiz Results

13 years ago
Explain it here so that other new members who might need this can also view the solution. Also, Fergie, look really carefully at the logic statements and see if you can see what she's doing. It makes a lot of sense, you just have to work through it yourself.

Quiz Results

13 years ago

Oh yeah, I understand it a bit more...

The only thing I'm still a bit confused about is the %MOST. Because, there's not going to BE a most. There's so many variables that it can be anything so... maybe I'm just overthinking this.

Quiz Results

13 years ago

Most is just representing another variable.

MOST = 1 means HAPPY was the highest

MOST = 2 means ANGRY was the highest

MOST = 3 means NORMAL was the higest

Like that, then using the MOST variable you decide what page to go to for your results.

Quiz Results

13 years ago

OOOOOH. Everything makes sense now! Thanks guys!

Quiz Results

13 years ago
Sweet. Glad that got cleared up

Quiz Results

13 years ago

Hmm. An error has occured in your theory. In the %MOST = 1 part, it didn't recognize '='.

Quiz Results

13 years ago
%MOST := 1

Quiz Results

13 years ago
Try that, it should fix your problem.

Quiz Results

13 years ago

Tried that. Then it said it didn't recognize the

END
END

part. Sigh. Maybe scripting just hates me.

Quiz Results

13 years ago
Show me the full script you are putting in.

Quiz Results

13 years ago
Or is it exactly like Zikara's?

Quiz Results

13 years ago

here it is (and I have to warn you, it's a 'who are you most like' quiz from this anime I watch, so there's a lot of names) :

 

IF %TOHRU > %AKITO THEN
BEGIN
IF %TOHRU > %ARISA THEN
BEGIN
IF %TOHRU > %AYAME THEN
BEGIN
IF %TOHRU > %HARU THEN
BEGIN
IF %TOHRU > %HATORI THEN
BEGIN
IF %TOHRU > %HIRO THEN
BEGIN
IF %TOHRU > %KAGURA THEN
BEGIN
IF %TOHRU > %KISA THEN
BEGIN
IF %TOHRU > %KYOTHEN
BEGIN
IF %TOHRU > %RITSU THEN
BEGIN
IF %TOHRU > %SAKI THEN
BEGIN
IF %TOHRU > %SHIGURE THEN
BEGIN
IF %TOHRU > %YUKI THEN
%MOST := 1
END
END

Quiz Results

13 years ago
Try it with as many END as there are BEGIN

Quiz Results

13 years ago

It works! Thanks licky!

Quiz Results

13 years ago
No problem! :D I was happy to help.

Quiz Results

13 years ago

This may sound stupid, but... with the

IF %MOST = 1 THEN
$DEST := @P2
IF %MOST = 2 THEN
$DEST := @p3

part, where would I put that?

Quiz Results

13 years ago
I would script it into the "see results" link.

Quiz Results

13 years ago

I thnk I put this whole thing together wrong...

So, say there are 10 questions and after you answer the 10th question, what would be the next pages and where would I put all the scripting?

Quiz Results

13 years ago

After the last question you should bring them to a page that pretty much just says "You're done".

Have a link on that page saying something like: "Click here for your results"

In that link, put the script to determine what page to link it to.

Quiz Results

13 years ago
Page 1: welcome to the quiz, bla bla bla
Page 2-11: questions 1-10
Page 12: Ok, now let's see your results
Page X: results

That is how I would do it. So long as you have the script working just cut and paste it over to where you need it now, it will be fine.

Quiz Results

13 years ago

BEEPBEEP BEEP BEEP BEEP BEP BEEP BEEP BEEPBEEP BEEP BEEP BEEP BEP BEEP BEEP BEEPBEEP BEEP BEEP BEEP BEP BEEP BEEP BEEPBEEP BEEP BEEP BEEP BEP BEEP BEEP BEEPBEEP BEEP BEEP BEEP BEP BEEP BEEP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

God fuck it! I can't believe this! It's all GONE!! All the damn scripting, gone! I copied it into my damn notebook on here but it's gone!!!

Ugh. It took me an hour to write out all that scripting. Now it's all GONE. I can't believe this, it's so stupid! Er...

Quiz Results

13 years ago
IF %TOHRU > %AKITO THEN
BEGIN
IF %TOHRU > %ARISA THEN
BEGIN
IF %TOHRU > %AYAME THEN
BEGIN
IF %TOHRU > %HARU THEN
BEGIN
IF %TOHRU > %HATORI THEN
BEGIN
IF %TOHRU > %HIRO THEN
BEGIN
IF %TOHRU > %KAGURA THEN
BEGIN
IF %TOHRU > %KISA THEN
BEGIN
IF %TOHRU > %KYOTHEN
BEGIN
IF %TOHRU > %RITSU THEN
BEGIN
IF %TOHRU > %SAKI THEN
BEGIN
IF %TOHRU > %SHIGURE THEN
BEGIN
IF %TOHRU > %YUKI THEN
%MOST := 1
END
END
END
END
END
END
END
END
END
END
END
END

Quiz Results

13 years ago

Looks like Uglick was nice. Just copy paste that a bunch of times and change the comparer values.

Quiz Results

13 years ago

I thought the only real scripting you needed was for determining which page to go to? If so you copied an old version here, just add a whole bunch of "END"s to the end of it, copy and paste that a bunch of times, and change the value you're comparing to for each one.

Unless you had another scripting part.

What happened anyways?

Quiz Results

13 years ago

I don't know! It's weird. I had saved it in the notebook but it's just...gone.

And I had to create a different scripting thing for each character name...which was 14 :(

Quiz Results

13 years ago
I often forget to actually hit save changes... :(

Quiz Results

13 years ago

Copy and paste is your friend.

Quiz Results

13 years ago
LOL that's exactly what I was thinking. ;)

Quiz Results

13 years ago

Alright...I'm now starting it...three done -_-

Quiz Results

13 years ago

Okay...so I just put all the scripting into the results link? Nothing else?

Quiz Results

13 years ago
Pretty much.

Quiz Results

13 years ago

So when will we see this quiz?

Quiz Results

13 years ago

I've actually recently run into a little problem . . . some of the variables are tying. Do you guys know a way so if it ties it goes to a specific question and only certain links appear depending on what is tying?

Quiz Results

13 years ago

It depends, if two are tying then you could do this:

IF %TOHRU = %HIRO THEN


$DEST := @TH1


END


However you have to do that for EACH combination possible. Which means you would need an additional 91 pages. Which is you know, a bit ridiculous. And even then, you could still have a three way tie, or two different two-way ties, and they would not work properly.

Since you have so many possiblities, you have two solutions that I can think of.

This first is to prevent ties altogether. However without knowing how your quiz works, I wouldn't really be able to say how to do it.

The second is to allow ties, you would have to change your code to be:

IF %TOHRU >= %AKITO THEN

And then what would happen is every variable that has the higest value, would be counted. Unfortunately this means that your MOST varaible wouldn't work anymore and instead you would have to have an additional 14 variables, to represent if a certain variable is one of the highest.

Something like this:

IF %TOHRU >= %AKITO THEN
BEGIN
IF %TOHRU >= %ARISA THEN
BEGIN
IF %TOHRU >= %AYAME THEN
BEGIN
IF %TOHRU >= %HARU THEN
BEGIN
IF %TOHRU >= %HATORI THEN
BEGIN
IF %TOHRU >= %HIRO THEN
BEGIN
IF %TOHRU >= %KAGURA THEN
BEGIN
IF %TOHRU >= %KISA THEN
BEGIN
IF %TOHRU >= %KYOTHEN
BEGIN
IF %TOHRU >= %RITSU THEN
BEGIN
IF %TOHRU >= %SAKI THEN
BEGIN
IF %TOHRU > %SHIGURE THEN
BEGIN
IF %TOHRU >= %YUKI THEN
%TOHRUMAX := 1
END
END
END
END
END
END
END
END
END
END
END
END

 

In this case, TOHRUMAX means that the TOHRU variable is the same value as the highest value in the group. You would then do that for each variable, replacing "MAX := " with YUKIMAX := 1 or SAKIMAX := 1, etc, etc. You would always set the value of the variable to 1, since we just want to know if they have the max value or not.

Then you can do one of two things, you can either show all of the highest results on one page (the result page) using the page scripting to show them all. So something like:

IF %TOHRUMAX := 1 THEN BEGIN
$PAGETEXT := $PAGETEXT + "<Insert Info about TOHRU>"
END
IF %YUKIMAX := 1 THEN BEGIN
$PAGETEXT := $PAGETEXT + "<Insert Info about YUKI>"
END

And do that for each character possible. If only one character actually has the max value, then only one section of info will be loaded onto the page.

The other way, is to prioritize the characters in a list, like so:

IF %TOHRUMAX := 1 THEN BEGIN
$PAGETEXT := $PAGETEXT + "<Insert Info about TOHRU>"
END
ELSE IF %YUKIMAX := 1 THEN BEGIN
$PAGETEXT := $PAGETEXT + "<Insert Info about YUKI>"
END
ELSE IF %SAKIMAX := 1 THEN BEGIN
$PAGETEXT := $PAGETEXT + "<Insert Info about SAKI>"
END

In this case, since the statement is ELSE IF instead of just IF, the first variable to equal one in the list will be used. So if TOHRUMAX and SAKIMAX both equal one, then TOHRUMAX will only be choosen since it is first on the list. This way is good only if you only want them to ever have 1 result.

I actually haven't used the scripting here yet, so you may need to play around with the BEGIN's and END's a bit before it works.

Theres other things that you could do after that, but that's a lot of info so I'll leave it at that for now. If you can, preventing a tie from ever happening is always the best way though.

 

Quiz Results

13 years ago

 . . . wow. I just thought of something like . . .

 

If ANYTHING tied, then it would go to a certain page using scripting like . . .

IF %TOHRU := %AKITO THEN
$DEST := @P30
IF %TOHRU := %ARISA THEN
$DEST := @P30
etc...

 

and then it would go to page 30 or whatever, and it would be a certain question. And then, some other scripting (which I don't know yet) would make only the links that the character is tied with appear. Of course, that scripting may not be made yet or may not ever work, and I'm just making this up at the top of my head so...

But if you can think of something that would be like that, then that would be awesome.

Quiz Results

13 years ago

So do you mean if there are ties, it will do something like "Which of these do you like most?", then list the links to the characters that all tied?

In short, if there's a tie then you just decide which one you like most?

Quiz Results

13 years ago
Alright. Here's the thing with this script. You are only thinking about if something ties for the top place. The script won't ignore things that tie for third, or even last. Then it'll act as though you tied for first for those characters.

I think I've worked out a bit of a solution, but I'm going to need to fully work it out, because its now confusing me. So I'm going to make a test game and come back to you on it.

Quiz Results

13 years ago

Well assuming she implmented my 14 MAX variables, all she we need to do is add them together.

If they add up to more than 1, it means that 2 or more tied. If they only add up to 1, it means that there is only one with the highest value.

Then regardless of how many ties there are, she can just go to the tie page.

From there (assuming she is just allowing the player to choose their favourite character), she would have 14 links on that page (one for each character), and in their variable restrictions property (of the link) would check if their respective variable is 1 or not. If it is one then the link appears, if not then it doesn't.

Though I'm still not sure if that's actually what she wants to do.

Quiz Results

13 years ago

I want it so only if the top place ties. Like how Z said (I didn't fully understand your explanation, Killa, so you might have been correct as well).

Quiz Results

13 years ago
Thats what it would do.