Another Date Sim Update 6.45, and an annoying Firefox bug

So after releasing 6.4 and squishing some bugs, one of the commenters posted this:

Another bug, if you go to the strip club with Rebecca then have sex with Ariane in the hot tub you can’t stay the night because Rebecca is in the bedroom. I had always felt bad about ditching her at the strip club anyway, but I think I would have noticed if we had brought her home with us.

The easy fix is one new line of code, but I realized he has a point about the post strip club party, and thought of a fun new scenario to add.  I then found myself in a common problem with this project which I call the “theme vs format” conflict.

A running theme in Dating Ariane simulator is that Ariane is a modern feminist who is not delicate or submissive.  She does only what she wants to do.  If it gives her pleasure, she will do it.  If it gives others pleasure, she may do it if she is assured a mutual exchange. …or really drunk.

The format of the game is (mostly) still images in a first person perspective.  It is supposed to play like a comic book, where you decide what happens next.  The advantage is that I do not have to usually show the player doing stuff, only Ariane’s reaction to the player doing stuff.

The conflict between the two is that it is difficult to portray a worthy mutual exchange of activities when we only see one point of view.  Like for example, how do I portray the player doing a striptease show without showing the actual player?  A series of reactions “stills” is kind of boring.  Then I came up with an idea that if the player is in motion, then his first person point of view will be in motion as well, so why not move the still image? Its a silly enough idea, it just might work, and I know it is possible because I have seen similar moving image effects on other HTML/javascript websites.  Its just a matter of figuring out how to do it.

While researching the problem, I ran into the old “every browser is different” problem, before eventually finding some code that smoothly moved an image linearly on all modern browsers.  That’s the good news.  The bad news is I did not want to move images linearly, I wanted wavy motion and circular motion.  The linear motion code is all done with loops, one loop to move the picture to the left, then another to move the picture to the right.  Since circular motion is a constantly changing direction, that complicates things greatly.

Then it hit me, what math functions go round and round and up and down?  Trig functions! (yes, there are opportunities to use Trigonometry after college)  I can rewrite the code to move in trig functions with ever increasing angles.  Start with angle a=0, x = sin a, y = cos a, then increase the value of a and recalculate.  (x,y) will form a perfect circle.  You do not even need to check for an end of the loop,  the value will just go round and round until you change the page.  Scaling the direction will create ovals instead of circles, and adding an absolute value y = |cos a| will make a U shape pattern.

Anyways, I wrote a new scenario using these tricks, and because it is only a small update, I am releasing version 6.45.

Get the full download here, or get a smaller 6.4 to 6.45 upgrade download here.

Another annoying Firefox bug

So I created a cool new scenario, what else can I do to finish out?  I have been thinking that the Comic Sans font I have been using, while fitting for the comic book theme, was getting old.  The best way around it is to convert the whole thing to external CSS, so with one line of code I can change the text font of the whole site to whatever I want.  This could be a fun new feature to play with.

Except I am running into another “every browser is different” problem.  For some reason Firefox does not register ongoing “onMouseover” events in one frame while handling an external CSS file in another frame.

Let me show you what I mean. Go to the online version of the date simulator here, then click on “Introduce yourself” and “Give her a hug”.  What you should see in the space below the picture is the words “You let go” written in navy blue in an Arial font.  If you are using Internet Explorer, that is exactly what you will see.  If you are in Safari, Opera or Chrome, you will see the text as soon as you move your mouse a tiny bit, which is wrong, but I can live with that.  In Firefox, you will only see the text if you move your mouse out of the picture (triggering an onMousout event) then move it back on the picture.  The only difference between this page and all the other pages is that this page uses a link to an external CSS file.  If I put in CSS code internally into the page, Firefox works fine, but that means changing 500 web pages to change a font, which defeats the whole purpose of doing CSS in the first place.

I’m not going to try and release a CSS version until I figure this one out.

Dating Sim Now Works in Firefox

So someone sent me a fix for my Dating Simulator so it will work on Firefox. I tested it, and it works.

Here is the problem in a nutshell:

In most programming languages, there are two kinds of subroutines: functions and procedures. In javascript, its all functions. The difference being that functions can return a value of some sort. Well because there are no procedures in javascript, I use functions as if they were procedures (so does everybody), so I do not return any value at all.

In IE, Opera, and Safari, if there is no return statement, it assumes the function is false and just moves on.
In Firefox, if there is no return statement, it assumes the function is true.

So with an html code like:
<a href=”#” ONCLICK=”parent.footer.choice1()” title=”try this”> IE etc, just execute the onclick command no questions asked.
Firefox executes the onclick, then (because the function is “true”) executes the anchor link # as well, which does not exist so the page gets refreshed instead, and the simulation is stumped!

I can’t remove the href, because IE will get stumped

So the fix is to change every onclick as follows:
<a href=”#” ONCLICK=”parent.footer.choice1();return false;” title=”try this”>
now it executes correctly in all browsers.

Now who is right, IE/Opera/Safari or Firefox/Mozilla?