Adventure Creator original thread

Tips, techniques and tutorials about creation tools.

Re: Adventure Creator main thread

Postby Wolfschadowe » Mon, 15Jul27 06:34

Sounds perfect!

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

Re: Adventure Creator main thread

Postby tlaero » Fri, 15Jul31 00:34

I just uploaded version 6.3 of AC. Mostly the Page Comment thing Wolf asked for.

http://www.mediafire.com/download/six8f ... reator.zip

Changes in 6.3
Added a page comment box that can be shown or not. Choose Edit->Show Page Comment. Page comments show in GameView and Dump GameView, but not Dump Game Text.

Changed the foreground color in the bypass buttons when there's something in the bypass. It should be easier to tell that a bypass is present now.

Worked around what appears to be a bug in Windows 10 that was making it hard to scroll the GameView with the mouse wheel.

This version requires that you update your AdventureCreator.exe and the AdventureCreator_template.txt.

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

Re: Adventure Creator main thread

Postby Wolfschadowe » Fri, 15Jul31 16:54

Thanks Tlaero!

I'll take it out for a spin over the weekend.

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

Re: Adventure Creator main thread

Postby Mortze » Wed, 15Aug05 18:28

Dear Masters of the Code,

May you enlight me on two misteries?

1/ What is the formula to substract a value from a variable? Is it VarPlus('variable', -1), or VarMinus('variable', 1), or something else?

2/ Can someone tell me what to write in the fuction when I need to check several variables and not only one.
Example:

function checkVolt()
{
var voltmeter = readVar("voltmeter");

if (voltmeter > 0)
{
window.location = "heli11.htm";
}
else
{
window.location = "heli11b.htm";
}

return false;
}

What if I wanted to check also a variable like "gas" and wanted it NOT above, let's say, 3.
So to proceed to heli11.htm the voltmeter has to be superior to 1 and the gas has to be below 3.
How do I write it?

A cookie for the wise one!
User avatar
Mortze
legend of the South Seas
 
Posts: 648
Joined: Wed, 14Oct29 02:34
sex: Masculine

Re: Adventure Creator main thread

Postby kexter » Wed, 15Aug05 20:40

Mortze wrote:1) What is the formula to substract a value from a variable? Is it VarPlus('variable', -1), or VarMinus('variable', 1), or something else?
It's a bit more complex than you might think at first glance, varPlus("variable", -1) and varMinus("variable", 1) may seem to achieve the same thing but there's a slight difference:
Code: Select all
// varMinus("variable", 1) will clamp the result to the [0, +MAX_INT] range.
// varPlus("variable", -1) won't.

// What does this mean in practice?

// Let's say that "variable" is currently 0. [readVar("variable") === 0 is true]
setVar("variable", 0);   // just to be sure :)
varPlus("variable", -1); // "variable" will be -1 at this point

// Now for the other case, let's reset "variable" to 0.
setVar("variable", 0);
varMinus("variable", 1); // "variable" will be 0 at this point

// Excercise: What will be the result of varMinus("variable", 5) if the starting value is -10?
// Answer: 0, of course.


Mortze wrote:2) Can someone tell me what to write in the fuction when I need to check several variables and not only one.
Code: Select all
// This is what tlaero would tell you:
function checkVolt()
{
    var voltmeter = readVar("voltmeter");
    var gas = readVar("gas");
   
    if (voltmeter > 0 && gas < 3)
    {
        GotoPage("heli11.htm");
    }
    else
    {
        GotoPage("heli11b.htm");
    }
}

// This is what I would tell you:
function checkVolt() {
  "use strict";
  var voltmeter = readVar("voltmeter"),
    gas = readVar("gas");
  if (voltmeter > 0 && gas < 3) {
    GotoPage("heli11.htm");
  } else {
    GotoPage("heli11b.htm");
  }
}

// And just to confuse you:
var checkVolt = function() { GotoPage(readVar("voltmeter") > 0 && readVar("gas") < 3 ? "heli11.htm" : "heli11b.htm"); }
@kextercius
User avatar
kexter
Moderator
 
Posts: 214
Joined: Sun, 13Dec29 11:01
sex: Masculine

Re: Adventure Creator main thread

Postby Wolf007 » Wed, 15Aug05 21:15

Mortze wrote:Dear Masters of the Code,

May you enlight me on two misteries?

1/ What is the formula to substract a value from a variable? Is it VarPlus('variable', -1), or VarMinus('variable', 1), or something else?

2/ Can someone tell me what to write in the fuction when I need to check several variables and not only one.
Example:

function checkVolt()
{
var voltmeter = readVar("voltmeter");

if (voltmeter > 0)
{
window.location = "heli11.htm";
}
else
{
window.location = "heli11b.htm";
}

return false;
}

What if I wanted to check also a variable like "gas" and wanted it NOT above, let's say, 3.
So to proceed to heli11.htm the voltmeter has to be superior to 1 and the gas has to be below 3.
How do I write it?

A cookie for the wise one!



1- I haven't see all the code so i don't know all the custom functions available and what is the impact of those other than changing the value of the variable (it may have some checks in place to avoid errors or negative values, that may or may not be required for your case). Generally speaking you may not don't need to use functions to make simple operations. To substract a value you can just use "operators":

variable = variable - 1;
or
variable -= 1;
or
variable--;

All three of those substracts one (1) to variable changing its value. The third one (variable--;) means decrement and can only be used to substract one unit at a time. The first two just change the value to whatever number you need o you can even user another variable:
x = x -y;
or
x -= y;

2- You can put a second "if" after the first:

if (voltmeter > 0)
{
if (gas < 3)
{
window.location = "heli11.htm";
}
else
{
window.location = "heli11b.htm";
}
}
else
{
window.location = "heli11b.htm";
}

OR check both at the same time (in this particular case, this may be better as there are only two possible options, but if you have more than 2 options the first example may be more flexible), try this:

if (voltmeter > 0 && gas < 3)
...

Note: "&&" is the Logical operator AND so it returns TRUE when ALL expressions are TRUE, "||" is the logical operator OR and returns TRUE when at least one of the expressions are TRUE.

Note 2: As stated before i haven't see all the code and all the dynamics of AC but in general coding If you will require to check "voltmeter" and "gas" in multiple occasions with different values (other than >1 and <3) you may need something more flexible and provide values of "voltthreshold", "gasthreshold", "pageA", "pageB" when calling the check function so you don't need to double code each time. You can even make generic functions for simple and double checks so they work for different variables.
Wolf007
sirens hunter
 
Posts: 11
Joined: Sun, 15Mar08 23:29
sex: Masculine

Re: Adventure Creator main thread

Postby Super » Wed, 15Aug05 21:33

^ Well AC uses javascript, so the rules for javascript apply. Doesn't look like that's the correct thing for that language...

As for 1, to subtract something just use Minus in place of Plus in the same statement.

Also, you can open up other games in Adventure Creator (like DWE) or their javascript files and take a look at their inner workings
Super
legend of the South Seas
 
Posts: 545
Joined: Wed, 11Aug24 20:59
sex: Masculine

Re: Adventure Creator main thread

Postby Mortze » Wed, 15Aug05 23:48

Dear Masters of the Code,

I do give you my apreciation for your Wisdom is great.

So great that it totally shadowes my total ignorance.

If your enlighted indications gave me some candle lighting on my 2nd question, I remain in the dark for the first one.
I simply couldn't understand a thing of the logic you tried to explain to me.

Please, code is chinese to me, so could you explain to me as if I was a todler monkey?
Better, insted of explaining, could you just vice me the alchemical formula for a minus variable?
I use VarPlus1('variable'). What should I use for a substraction by 1 point?

Sorry for this but I really can't understand code :) and thank you for your patience.
User avatar
Mortze
legend of the South Seas
 
Posts: 648
Joined: Wed, 14Oct29 02:34
sex: Masculine

Re: Adventure Creator main thread

Postby Super » Thu, 15Aug06 00:30

Mortze wrote:I use VarPlus1('variable'). What should I use for a substraction by 1 point?.


VarMinus1('variable')
Super
legend of the South Seas
 
Posts: 545
Joined: Wed, 11Aug24 20:59
sex: Masculine

Re: Adventure Creator main thread

Postby kexter » Thu, 15Aug06 07:21

Super wrote:
Mortze wrote:I use VarPlus1('variable'). What should I use for a substraction by 1 point?
VarMinus1('variable')
First of all it's varPlus1() and varMinus1() - capitalization is important!
Secondly the correct answer is: it depends on whether you want values to go below zero or if you want to forbid negative values.
If you want negative values, use varPlus("variable", -1) else use varMinus("variable"). [Note: varPlus("variable") is the same as varPlus1("variable") and varMinus("variable") is the same as varMinus1("variable")]
I advise against using varPlus1() or varMinus1() because if later you want to change how much you want to add to or subtract from a value then it's safer to update varPlus("variable", 1) to varPlus("variable", 5) as this way you avoid the pitfall scenario where you accidentally write varPlus1("variable", 5) because in that case "variable" will be increased by only 1, not 5.

Mortze wrote:Please, code is Chinese to me, so could you explain to me as if I was a toddler monkey?
Say you want to achieve the following:
If the voltmeter shows a value greater than 0 and there's less than 3 units of gas then go to page "heli11.htm" else go to page "heli11b.htm".
if (voltmeter > 0 && gas < 0) { GotoPage("heli11.htm"); } else { GotoPage("heli11b.htm"); }

How do you check the current value of a game-variable in AC? You call readVar("variable")
What does var gas = readVar("gas"); and the like do? You declare a local variable called gas that will hold the value of the game variable so you won't have to call readVar("gas") multiple times, you can just check against gas.
What is && (and || for that matter)? && means and, || means or. Basically if you have the logic figured out in you head then you just have to write && where you think and and || where you think or.

So converting the initial statement to actual code:
Code: Select all
function checkVolt() {
  // Declare local variables to hold the values of the "voltmeter" and "gas" game-variables.
  var voltmeter = readVar("voltmeter");
  var gas = readVar("gas");
  // If the voltmeter shows a value greater than 0 and there's less than 3 units of gas then
  if (voltmeter > 0 && gas < 3) {
    // Go to page "heli11.htm"
    GotoPage("heli11.htm");
  } else {
    // Else go to page "heli11b.htm"
    GotoPage("heli11b.htm");
  }
}
@kextercius
User avatar
kexter
Moderator
 
Posts: 214
Joined: Sun, 13Dec29 11:01
sex: Masculine

Re: Adventure Creator main thread

Postby Wolfschadowe » Mon, 15Aug31 19:16

tlaero wrote:Changes in 6.3
Added a page comment box that can be shown or not.
Bug with the page comments.

When creating an Area target, after filling the title section, if you go to page comments and start typing, the comment appears over the image in the area target, and then it replaces the active area target title text.

Hard to explain, but obvious if you play with it a bit. Always repeatable.
User avatar
Wolfschadowe
legend of the South Seas
 
Posts: 559
Joined: Thu, 13Mar21 07:37
Location: West Coast, USA
sex: Masculine

Re: Adventure Creator main thread

Postby Wolfschadowe » Mon, 15Aug31 23:26

Feature Request:

Use of single character wildcard (?) in Game View Filename search (And possibly "All", but my need for the moment is Filename)
Secondary: Use of multiple character wildcard (*) in Game View Filename search.

Example:
If I have filenames:
thbar001fem.htm
thbar001em.htm
thbar001db.htm
thbar002fem.htm
thbar002em.htm
thbar002db.htm

I could use a search of thbar???em to return:
thbar001em.htm
thbar002em.htm

Secondary, I could use a search of thbar*em to return:
thbar001em.htm
thbar001fem.htm
thbar002em.htm
thbar002fem.htm

If for some reason, only one is possible, I would prefer the single character wildcard of "?"
Any wildcard marker will do, I'm just suggesting the ones I feel are most common for Windows. Could be % or ¿ or ├ or whatever. :)
Thanks again for all your help and work on AC!
Wolfschadowe
User avatar
Wolfschadowe
legend of the South Seas
 
Posts: 559
Joined: Thu, 13Mar21 07:37
Location: West Coast, USA
sex: Masculine

Re: Adventure Creator main thread

Postby tlaero » Wed, 15Sep02 03:09

I happen to be in the code right now (I'm adding an image viewer for myself), so now is a good time for a feature request. (-: How about if I add a "RegEx" checkbox and, if you check it, it does full Regular Expression parsing? Then you can do pretty much anything you'd like.

I'll also look into the bug.

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

Re: Adventure Creator main thread

Postby tlaero » Wed, 15Sep02 03:34

Wolfschadowe wrote:When creating an Area target, after filling the title section, if you go to page comments and start typing, the comment appears over the image in the area target, and then it replaces the active area target title text.


Wow! I just reproed that but haven't looked into it yet. I think it would have been hard to do that if I'd tried... Whatever it is, I'll fix it though. (-:

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

Re: Adventure Creator main thread

Postby tlaero » Wed, 15Sep02 03:44

Doh. Copy and paste error. I lifted the routine for changing the title text when I made the routine for changing the comment block, but left the "update the title" code in it. I never saw it because I never had an area in focus when testing the page comment.

6.4 will have the fix. To work around it in the mean time, make sure no areas have focus before changing the page comment. If one has focus, you can left click on an empty part of the picture to take the focus away. Or you can save and re-open the htm file.

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

PreviousNext

Return to The workshop of creators

Who is online

Users browsing this forum: No registered users and 12 guests

eXTReMe Tracker