Adventure Creator original thread

Tips, techniques and tutorials about creation tools.

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

Postby tlaero » Wed, 12Nov21 19:36

I don't understand the "gameShowScore2" question. What are you trying to do? Are you trying to show different strings in different situations? You can do that all in gameShowScore. Give me an example of what you want, and I'll show you how to do it.

As for adding one variable and subtracting another in one onclick, that's kind of a pain. Many browsers don't let you call two functions in an onclick, so you have to write a function that calls your two.

For instance, add the following function to your _game.js

function varPlusAndMinus(name1, plus, name2, minus)
{
varPlus(name1, plus);
varMinus(name2, minus);
}

Then in the onclick do
varPlusAndMinus('One', 5, 'Two', 4)

You can write any function you want and call it from the onclick.

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, 12Nov21 19:37

Note, that code was supposed to be indented, but the message board removes the spaces.

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 Dakutis » Wed, 12Nov21 19:46

I need to write different scores in different places, so with only one gameShowScore its not possible to do.
About Plus/Minus I can to write in html onclick function checkData() and then in _game.js write function checkData() with that function you write, so it be, first check one value then if its ok PlusMinus if not - other>?

function checkData()
{
var happy = readVar("First");

if (first > 10) (dont know how further)
{
window.location = "home02.html"; (there I need varPlusAndMinus('One', 5, 'Two', 4)
}
else
{
window.location = "home03.html";
}

return false;
}


And one more thing, how to do that score points don't be more then 100, something like: you have 99 and get +3 but score should be 100. ( I think I need write check function and then I don't know what :??: )
http://dakutisgames.weebly.com/
User avatar
Dakutis
lagoon predator
 
Posts: 116
Joined: Wed, 12Nov07 14:17
Location: Lithuania, Kaunas
sex: Masculine

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

Postby Squeeky » Wed, 12Nov21 22:58

I haven't looked at tlaero's code for some time but if I wanted to ensure that a defined value did not go over a limit I'd define that limit and then if that defined value went above the limit it would become the limit, like:

var maxScore = 100;

function checkScore() {
if (score > maxScore) {
score = maxScore;
}
}
Squeaky is clean, I'm just a tad messy!
User avatar
Squeeky
Spirit of the oceans
 
Posts: 4169
Joined: Mon, 08Jan07 00:00
Location: Australia
sex: Masculine

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

Postby tlaero » Wed, 12Nov21 23:11

Do you want to show three different scores at the same time in three different places on the screen? Or do you want "if this situation is true, show this score, but if this situation is true, show that score"? AdventureCreator doesn't have a way to do the first one, but the second is pretty easy and I can show you how.

Here's the function you asked for. Two things to note:
Its "var first" not "var happy" because you later check if first > 10, not if happy > 10.
In game.js, you use doublequotes around strings, but in onclick you use single.

So, below its varPlus("One", 5); but in an onclick it would be varPlus('One', 5);

function checkData()
{
var first = readVar("First");

if (first > 10)
{
varPlus("One", 5);
varMinus("Two", 4);
window.location = "home02.html";
}
else
{
window.location = "home03.html";
}

return false;
}

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, 12Nov21 23:14

Regarding capping the score at 100. Say you've got this calcScore function.

function calcScore()
{
var score = readVar("happy") - readVar("angry");
return score;
}

Just change it to be like this:

function calcScore()
{
var score = readVar("happy") - readVar("angry");

if (score > 100)
{
score = 100;
}

return score;
}

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 Dakutis » Thu, 12Nov22 06:37

I need something like that (about gameShowScore) and that debug scores should be at the bottom of the page.

....score1......score2..........................score3...
...........................text .............................
____________________________________________
|............................................................|
|............................................................|
|............................................................|
|.........................img.jpg..........................|
|............................................................|
|............................................................|
|............................................................|
|___________________________________________|

.................|tables| tables| tables|................
.......................................Save Restore


And one more question:

function calcScore2()
{
var Data = (readVar("One") + readVar("Two") + readVar("Three"))/3;
return Data;
}
In this function I get (like: (5+6+8)/3=6,333333333333) but in score I dont need numbers after the decimal point( i need round to 6, there is working round fuction?)
http://dakutisgames.weebly.com/
User avatar
Dakutis
lagoon predator
 
Posts: 116
Joined: Wed, 12Nov07 14:17
Location: Lithuania, Kaunas
sex: Masculine

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

Postby Squeeky » Thu, 12Nov22 06:54

Question:
Is the layout that you give intended to be the design for each of your HTML pages?
Or will it occur from time to time?

Either way this looks like you need a CSS (Cascading Style Sheet) template whose parameters call in the data which you require rather than HTML code each page as needed. Is that what you need?


[At the time of posting I see tlaero was present so she may have a solution but she will have missed you additional edit.
Squeaky is clean, I'm just a tad messy!
User avatar
Squeeky
Spirit of the oceans
 
Posts: 4169
Joined: Mon, 08Jan07 00:00
Location: Australia
sex: Masculine

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

Postby tlaero » Thu, 12Nov22 06:56

I understand now. There's currently no way to do that with AdventureCreator. If you changed the template, you could probably make it work, but you'd lose your changes the next time I updated it. I'll think about adding something in the next AC. However, I'm not sure that's a good idea. People with 1024x768 screens only have room for 5 lines of text. If you use one of them for a top score you limit the amount of dialog you can put on the screen by 20%.

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 Dakutis » Thu, 12Nov22 07:02

tlaero wrote:I understand now. There's currently no way to do that with AdventureCreator. If you changed the template, you could probably make it work, but you'd lose your changes the next time I updated it. I'll think about adding something in the next AC. However, I'm not sure that's a good idea. People with 1024x768 screens only have room for 5 lines of text. If you use one of them for a top score you limit the amount of dialog you can put on the screen by 20%.

Tlaero


OK then. What about round

Dakutis wrote:function calcScore2()
{
var Data = (readVar("One") + readVar("Two") + readVar("Three"))/3;
return Data;
}
In this function I get (like: (5+6+8)/3=6,333333333333) but in score I dont need numbers after the decimal point( i need round to 6, there is working round fuction?)


Squeeky - it will be in each page.
http://dakutisgames.weebly.com/
User avatar
Dakutis
lagoon predator
 
Posts: 116
Joined: Wed, 12Nov07 14:17
Location: Lithuania, Kaunas
sex: Masculine

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

Postby Squeeky » Thu, 12Nov22 07:12

For the rounding function you need:
Math.round(x)

Now that rounds to the nearest integer so depending on the decimal value that could be up or down.
the page @: http://www.w3schools.com/jsref/jsref_obj_math.asp gives Math functions.
Squeaky is clean, I'm just a tad messy!
User avatar
Squeeky
Spirit of the oceans
 
Posts: 4169
Joined: Mon, 08Jan07 00:00
Location: Australia
sex: Masculine

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

Postby Dakutis » Thu, 12Nov22 07:27

At first, I wanted to show the results on the left side, and I was able to do it. I divide the page into two parts 200px left, 800px right, in left I add all scores, in right image file, but image file I add like background. And problem is that now dont working size.css, size2.css. And for users with 1024x768 resoliution don't good.

................text....................
________________________________________
|................|.....................................|
|.score1.......|.....................................|
|................| ....................................|
| score2........|...........background............|
|................|..............img.jpg.............|
| score3.......|.....................................|
|................|.....................................|
|Save game...|.....................................|
|Load game...|.....................................|
|___________|___________________________
.................|tables| tables| tables|...........
http://dakutisgames.weebly.com/
User avatar
Dakutis
lagoon predator
 
Posts: 116
Joined: Wed, 12Nov07 14:17
Location: Lithuania, Kaunas
sex: Masculine

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

Postby Squeeky » Thu, 12Nov22 08:03

Looking back at the rounding function, I see that you need to round down so:
Math.floor(x)
if you haven't already found that.

As to the resolution I have no idea.
Squeaky is clean, I'm just a tad messy!
User avatar
Squeeky
Spirit of the oceans
 
Posts: 4169
Joined: Mon, 08Jan07 00:00
Location: Australia
sex: Masculine

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

Postby tlaero » Thu, 12Nov22 08:09

I've made a number of these games and they've been fairly highly regarded. In my opinion, players care about the following things in priority order.
1) Great sex scenes
2) A good challenge
3) Good artwork
4) Interesting characters
5) A believable story
6) Not needing to start over when they make a mistake.
...
...
...
1000) Where the score is on the screen.

I think your time would be MUCH better spent focusing on items 1-5 than trying to move the score.

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 LRM » Thu, 12Nov22 08:25

tlaero wrote:I've made a number of these games and they've been fairly highly regarded. In my opinion, players care about the following things in priority order.
1) Great sex scenes
2) A good challenge
3) Good artwork
4) Interesting characters
5) A believable story
6) Not needing to start over when they make a mistake.
...
...
...
1000) Where the score is on the screen.

I think your time would be MUCH better spent focusing on items 1-5 than trying to move the score.

Tlaero

Provided 1000 doesn't happen on top of 1!
Got Wood?
User avatar
LRM
Moderator
 
Posts: 3061
Joined: Wed, 09Apr22 23:00
Location: Citizen of the world, residing in the USA
sex: Masculine

PreviousNext

Return to The workshop of creators

Who is online

Users browsing this forum: No registered users and 5 guests

eXTReMe Tracker