Adventure Creator original thread

Tips, techniques and tutorials about creation tools.

Re: A tool to help write "Virtual Date" games

Postby Super » Sun, 13Sep29 18:06

Well, my (limited) experience is in Java. but it still should be enough to push me through this project.

Though, when I changed it to ==, now it doesn't make me go anywhere? It just adds # to the end of the URL and stays on the same slide... I have the function in the onClick with nothing in the href...
Super
legend of the South Seas
 
Posts: 545
Joined: Wed, 11Aug24 20:59
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby tlaero » Sun, 13Sep29 19:40

Post the _game.js and the htm file and I'll take a look.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: A tool to help write "Virtual Date" games

Postby tlaero » Sun, 13Sep29 20:16

I've uploaded v4.1 of AC.

https://hotfile.com/dl/248063211/e38786 ... r.zip.html

Changes in 4.1
Added a toggle to not check for broken links in GameView. Use this to increase perf if checking for broken links is slowing you down.
Removed two old toggles and defaulted them to on. There is no need to disable these things anymore.
Fixed the exceptions around browsing to non-existent HTML files (and similar things).
Added the ability to add an onmousedown and onmouseup to the image and map targets. This allows more complex minigames to be written.
Fixed the example to show the green and red bars correctly when starting from Start.htm.


Sorry, Wolf. Word wrap in GameView isn't something I'm going to do. Too many assumptions rely on it the way it is.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: A tool to help write "Virtual Date" games

Postby Wolfschadowe » Mon, 13Sep30 04:21

Took it out for a spin, and it works great. As much as I love the link check, it's nice to be able to disable it. I helps my spell check pass immensely. :)

I suspected there may be too much going on under the hood for wrap on the game view, no disappointment here. Do I need to transfer style or .js files to a work in progress?

Once again, great work! Thanks a lot Tlaero!

Wolfschadowe
User avatar
Wolfschadowe
legend of the South Seas
 
Posts: 559
Joined: Thu, 13Mar21 07:37
Location: West Coast, USA
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby tlaero » Mon, 13Sep30 06:40

Nope, no need to change the js or cs files this time around. Just the exe.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: A tool to help write "Virtual Date" games

Postby Super » Mon, 13Sep30 19:11

tlaero wrote:Post the _game.js and the htm file and I'll take a look.

Tlaero


No need, figured it out myself! Basically, I had the == where the = should have been and the = where the == should have been. Now it's working!

... No wait, no it's not. Now, it just automatically goes to the else statement even if libCompliment has been activated... This is still my function:

Code: Select all
function checkLibCompliment()
{

    var libCompliment = readVar("libCompliment");
   if (libCompliment == 1)
   {
      window.location = "lib9e.html";
   }
   else
   {
      window.location = "lib9f.html";
   }
}


This is what happens in onClick when my variable is triggered:

varPlus1('libCompliment’);

And this is my onClick for checking libcompliment:

checkLibCompliment();

Yep. Newbie mistakes, am I right?
Super
legend of the South Seas
 
Posts: 545
Joined: Wed, 11Aug24 20:59
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby Wolfschadowe » Mon, 13Sep30 19:45

My javascript is weak, but I'll try to help with this. Here are my troubleshooting steps when I encounter this problem.

1. Confirm the variable is correct in debug mode.
2. In Firefox, using the firebug plug-in, see if there are any JS errors.
3. Put in a stop using firebug and step through the page load to watch what happens to the variables (advanced, took me a while to figure out how to do it.)

Also, if using firefox, or for firefox compatibility, you should end your statement with:

return false;

Put it just before the last bracket of the function anytime you use the window.location command in game.js. At least, I'm pretty sure that's where you use it, I'm sure Tlaero will correct me if I'm wrong. [img]images/icones/icon13.gif[/img]

I don't see any obvious error in your function though. Maybe try changing it to:

if (libCompliment >= 1)

That way if it somehow advances to 2, you are still covered.

Personally, for my own sanity, I try to avoid using the same name for the Global variable and the local variable. I would go with this personally:

Code: Select all
function checkLibCompliment()
{

   var compliment = readVar("libCompliment");
   if (compliment == 1)
   {
      window.location = "lib9e.html";
   }
   else
   {
      window.location = "lib9f.html";
   }
return false;
}


Hope this helps! Sometimes my help results in the exact opposit, no help at all :crazy:
Wolfschadowe
User avatar
Wolfschadowe
legend of the South Seas
 
Posts: 559
Joined: Thu, 13Mar21 07:37
Location: West Coast, USA
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby tlaero » Wed, 13Oct02 03:51

Superawesome sent me his code.

First, you should never change _functions.js. I update that frequently and you want to be able to copy the updated one into your game. You should put your functions in _game.js. That's where game-specific stuff goes.

Speaking of which, you've got an old version of _functions.js which doesn't match the version of AC you're using. I'll bet I forgot to update the _functions.js in the tutorials when I last updated it. First copy your function into _game.js, then replace the _functions.js with the one in example rather than tutorial.

Now, to teach you how to fish. Open Internet Explorer (not Firefox or Chrome) and drag _begin.htm into it. Nothing is working, so hit F12. This brings up the debugger that's built in to IE. In the debugger click on the "Script" tab.
On the right side it says: Refresh the page to see messages that may have occurred before the F12 tools were opened.
Refresh the browser and now you'll see something like:

SCRIPT1004: Expected ';'
_game.js, line 31 character 23
SCRIPT5009: 'gameVars' is undefined
_functions.js, line 984 character 9

I copied the function into _game.js, and line 31 is in it.

Code: Select all
function checkLibCompliment()
{

    var libCompliment == readVar("libCompliment");
    if (libCompliment = 1)
    {
        window.location = "lib9e.html";
    }
    else
    {
        window.location = "lib9f.html";
    }
}


Line 31 is this one.

Code: Select all
    var libCompliment == readVar("libCompliment");


That is supposed to be = not ==. Remember, one equals to set, two to check. Speaking of which, the next line needs two.

Code: Select all
    if (libCompliment = 1)


You need to change these two lines to:

Code: Select all
    var libCompliment = readVar("libCompliment");
    if (libCompliment == 1)


The other error is harder to figure out, but in the end, it's because of this line.

Code: Select all
var gameVars = ["cssSize", "happy", "test", "confidence", "april", "libCompliment = 0"];


You can't have the = 0 in there. Your last variable isn't "libCompliment" it's "libCompliment = 0". Make the line:

Code: Select all
var gameVars = ["cssSize", "happy", "test", "confidence", "april", "libCompliment"];


Okay, go do those things while I look over the rest of this.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: A tool to help write "Virtual Date" games

Postby tlaero » Wed, 13Oct02 04:15

Okay, now to debug the html. First go to _game.js and find the line that says:

Code: Select all
var gameDoDebug = 0;


Make it say this instead.
Code: Select all
var gameDoDebug = 1;


Now the game is in debug mode and you can see the values of your variables at all times. Go through the tutorial and click "Hey there, Celina."
Note that the "happy" variable didn't update. So there's a problem there.

Here's why:
varPlus1(‘happy’);

Notice the curly quotes? JavaScript doesn't believe in them. Did you write that in word or something? AC doesn't add curly quotes. Replace them with straight quotes.
varPlus1('happy');

Try again and now you'll see "happy" update.

You have the same problem in lib4, lib8, lib8a, lib8b, lib8c, lib8d, lib9a, lib9c, lib9e, and lib9f.

Fix all of those and your variables will work, and so will the function.

But you have another problem. In lib8b you have in an onclick:

varMinus1(‘happy’); varMinus1(‘test’); varPlus1(‘confidence’);

You can't do that. An onclick can only call one function.

I'm at the limit of what my wrist can type in one sitting, so I'll let Wolf explain what to do here.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: A tool to help write "Virtual Date" games

Postby Wolfschadowe » Wed, 13Oct02 04:37

tlaero wrote:Open Internet Explorer (not Firefox or Chrome) and drag _begin.htm into it. Nothing is working, so hit F12. This brings up the debugger that's built in to IE. In the debugger click on the "Script" tab.
I didn't know this existed. I've been using Firefox with the FireBug plug-in, which happens to look and function exactly like the built-in IE debugger. Thanks for the new fishing pole Tlaero!

tlaero wrote:I'm at the limit of what my wrist can type in one sitting, so I'll let Wolf explain what to do here.
Sure, I'll give it a go. :) Take care of that wrist!

Superawesomemans,
In the onclick, this won't work: varMinus1(‘happy’); varMinus1(‘test’); varPlus1(‘confidence’);

What you CAN do; however, is add a reusable function in your game.js:
Code: Select all
function varMinusMinusPlus1(first,second,third)
{
     varMinus1(first);
     varMinus1(second);
     varPlus1(third);
}


Then in your onclick, put:

varMinusMinusPlus1('happy','test','confidence')

When it goes to the function, "happy' = first, 'test' = second, and 'confidence' = third. Note that there are no single quotes in the function in _game.js. That's because we are providing them when we enter the function into onclick in Adventure Creator.

I do this all the time in BEW, which is probably why Tlaero pitched this over to me. Once you have that function in your _game.js, you can call it whenever you need it. You can create as many permutations as you like. Create a varMinusPlusPlus1, and a varPlusPlusPlus1, a varMinusMinusMinus1. Mix it up any way you want. You could do a setVarPlus1, for example, which would look like this:

Code: Select all
function setVarPlus1(first,value,second)
{
     setVar(first,value);
     varPlus1(second);
}


Let me know if this helps.

Wolfschadowe
User avatar
Wolfschadowe
legend of the South Seas
 
Posts: 559
Joined: Thu, 13Mar21 07:37
Location: West Coast, USA
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby tlaero » Wed, 13Oct02 04:55

Thanks Wolf. (-:

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: A tool to help write "Virtual Date" games

Postby TeineWolf » Wed, 13Oct02 05:26

I'm kinda burnt out when I ran across this issue with Javascript. Too tired to learn new shyte, but here's what my brain tried to start doing. I'll research it better tomorrow when I am more cognitive, or maybe I can point you in the right direction. I don't know the exact syntax/logic of the onClick function. So I don't know off hand, if onClick handles multiple variables, the same way as multiple functions. Or heck, ever if they are the same thing as far as the command cares.

My guy instinct is they are handled differently, and might have to be formatted differently for each type. Just need to find a correct example to of each, to ummmm create a template, for educational purposes only. ;)
User avatar
TeineWolf
lagoon predator
 
Posts: 178
Joined: Thu, 13Aug15 23:58
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby me3 » Wed, 13Oct02 19:16

Wolfschadowe wrote:
tlaero wrote:Open Internet Explorer (not Firefox or Chrome) and drag _begin.htm into it. Nothing is working, so hit F12. This brings up the debugger that's built in to IE. In the debugger click on the "Script" tab.
I didn't know this existed. I've been using Firefox with the FireBug plug-in, which happens to look and function exactly like the built-in IE debugger. Thanks for the new fishing pole Tlaero!

Chrome/chromium and opera has developer tools too...firefox comes with it by default too...so that covers all major browsers really.
So in short, you can use any of the browsers, this is far from anything specific to IE, so use the browser you're most familiar with etc
me3
great white shark
 
Posts: 89
Joined: Sun, 07Dec02 00:00

Re: A tool to help write "Virtual Date" games

Postby Super » Wed, 13Oct02 23:29

Ah, what happened was I copied the onClick variable modifiers from the tutorial document, which yes was in Micosoft Word. Wanted to make sure I didn't have any errors in typing it but it seems that was the source of my problems XD Oh well, thanks both of you.
Super
legend of the South Seas
 
Posts: 545
Joined: Wed, 11Aug24 20:59
sex: Masculine

Re: A tool to help write "Virtual Date" games

Postby TeineWolf » Thu, 13Oct03 04:11

Superawesomemans wrote:but it seems that was the source of my problems XD Oh well, thanks both of you.
Always use note pad for stuff like that. I always keep a page open, in case I need to do quick dirty editing. UTF (Unformated Text Format) makes life so much easier. Or copying from an open word document, into notepad, then use the notepad copy, to do the actual pasting.
User avatar
TeineWolf
lagoon predator
 
Posts: 178
Joined: Thu, 13Aug15 23:58
sex: Masculine

PreviousNext

Return to The workshop of creators

Who is online

Users browsing this forum: No registered users and 7 guests

eXTReMe Tracker