How to do this in javascript? RESOLVED

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

How to do this in javascript? RESOLVED

Postby PINGO TINTO » Tue May 31, 2011 1:58 am

How to do this in javascript?

If fire1_on = 1 Then
Action.GoToFrame "adventuremaker014"
Else
Action.GoToFrame "adventuremaker012"
End If


How to get here in html?? Anyone know?

<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>texte_video</title>
<meta name='viewport' id='viewport' content='width=1024;initial-scale=1.0;minimum-scale=1.0;maximum-scale=1.0;user-scalable=false;'>
<meta name='GENERATOR' content='Adventure Maker version 4.6.1'>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
<script>
var remainingElementsToLoad = 3;
function elementLoaded(){
remainingElementsToLoad--;
if (remainingElementsToLoad == 0){
parent.showNextFrame();
}
}
var hotspotsCount = 2;
var hotspot;
hotspot = new Array;
hotspot[1] = new parent.hotspotClass('00021.htm','','',null,null,null,null,null,"");
hotspot[2] = new parent.hotspotClass('00023.htm','','',null,null,null,null,null,"");
</script>
</head>
<body bgcolor='000000' onLoad='parent.initializeFrame();'>
<div id='textBackgroundPreload' style='position:absolute; left:0px; top:0px;'><img width=1 height=1 src='textbackground.png' /></div>
<div id='hourglassPreload' style='position:absolute; left:0px; top:0px;'><img width=1 height=1 src='hourglass.png' /></div>
<div id='background' style='position:absolute; left:0px; top:0px; width:1024px; height:768px;'><img src='00014.a' onLoad='elementLoaded();' /></div>
<div id='hotspot1' style='position:absolute; left:3px; top:54px; width:196px; height:672px;'><img id='hotspotImg1' src='transparent.gif' width=196 height=672 onClick='parent.doHotspotClick(1);' onLoad='elementLoaded();' /></div>
<div id='hotspot2' style='position:absolute; left:834px; top:60px; width:182px; height:677px;'><img id='hotspotImg2' src='transparent.gif' width=182 height=677 onClick='parent.doHotspotClick(2);' onLoad='elementLoaded();' /></div>
<div id='textBackground' style='position:absolute; left:0px; top:741px; visibility:hidden;'><img width=1024 height=27 src='textbackground.png' /></div>
<div id='message' style='position:absolute; color:#FFFFFF; text-align:center; left:0px; top:748px; width:1024px; height:32px; visibility:hidden'>_</DIV>
<div id='hourglass' style='position:absolute; left:496px; top:352px; visibility:hidden;'><img width=32 height=64 src='hourglass.png' /></div>
</body>
</html>


I am beginning to get tired of talking and no one answers.
At least say it is not possible.
Or if they say as well and explicit.

Thanks
Last edited by PINGO TINTO on Wed Jun 01, 2011 11:51 pm, edited 1 time in total.
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Postby reneuend » Tue May 31, 2011 2:28 am

A lot of us don't use the HTML export, so you might not get a quick response. I don't use AM for building HTML/Javascript. In fact, I think it would be easier to build a game directly in an html editor.

Here is my best guess from looking at your example:

Code: Select all
var hotspotsCount = 2;
var hotspot;
hotspot = new Array;
hotspot[1] = new parent.hotspotClass('00021.htm','','',null,null,null,null,null,"");
hotspot[2] = new parent.hotspotClass('00023.htm','','',null,null,null,null,null,"");


These are your variables above.

Code: Select all
<div id='hotspot1' style='position:absolute; left:3px; top:54px; width:196px; height:672px;'><img id='hotspotImg1' src='transparent.gif' width=196 height=672 onClick='parent.doHotspotClick(1);' onLoad='elementLoaded();' /></div>


If you click on this area, it looks like it loads hotspot1

the other <div> tag in the html is for hotspot2


to me, it looks like its setup correctly. but it's not that simple to read. the things to look for is the <div> tag's ID. This is how the javascript identifies what is being clicked on.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2691
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby PINGO TINTO » Tue May 31, 2011 2:45 am

reneuend wrote:A lot of us don't use the HTML export, so you might not get a quick response. I don't use AM for building HTML/Javascript. In fact, I think it would be easier to build a game directly in an html editor.

Here is my best guess from looking at your example:

Code: Select all
var hotspotsCount = 2;
var hotspot;
hotspot = new Array;
hotspot[1] = new parent.hotspotClass('00021.htm','','',null,null,null,null,null,"");
hotspot[2] = new parent.hotspotClass('00023.htm','','',null,null,null,null,null,"");


These are your variables above.

Code: Select all
<div id='hotspot1' style='position:absolute; left:3px; top:54px; width:196px; height:672px;'><img id='hotspotImg1' src='transparent.gif' width=196 height=672 onClick='parent.doHotspotClick(1);' onLoad='elementLoaded();' /></div>


If you click on this area, it looks like it loads hotspot1

the other <div> tag in the html is for hotspot2


to me, it looks like its setup correctly. but it's not that simple to read. the things to look for is the <div> tag's ID. This is how the javascript identifies what is being clicked on.


He did not explain what I wanted to know.
But thanks anyway.

I think the only person who can help me is the Mistery
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Postby mercedes » Tue May 31, 2011 6:14 am

You want to go to a frame when fire1_on = 1
Else go to a different frame..?

You want to be able to input this; into the HTML code above..?

If fire1_on = 1 Then
Action.GoToFrame "adventuremaker014"
Else
Action.GoToFrame "adventuremaker012"
End If

**
I'm not sure I understand why you can't use the variable tab..? and Hotspots..

I haven't used the HTML export in a long time-and I only used it once.....However there are variable tabs are there not..?

I was thinking to just stack 2 hotspots on top of each other;
One going to Adventuremaker012
One going to Adventuremaker014

Perhaps I'm misunderstanding what you want to do..If so..I apologize...
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Tue May 31, 2011 4:44 pm

Lyberodoggy wrote:Judging from the html code produced by the engine what you need to do is:

1) Create two hotspots, one that sends to the frame called adventuremaker014" and another to "adventuremaker012".
2)Overlap these hotspots with one bigger that does nothing in order to make them unclickable.
3)add this code to the html file (replace hotspot1 and hotspot2 with the actual integers that represent the hotspots' indices):

Code: Select all
if(fire1_on == 1){
parent.doHotspotClick(hotspot1);
}else{
parent.doHotspotClick(hotspot2);
}



4)Tell me if it actually worked.


Bumping my previous post:

actually to get it to work you need one minor adjustment.
Change this line:
<body bgcolor='000000' onLoad='parent.initializeFrame();'>
to
<body bgcolor='000000' onLoad='start()'>


Then go right above the </script> tag and add this code:

Code: Select all
function start(){
   parent.initializeFrame();
   if(fire1_on == 1)
   {
      parent.doHotspotClick(1);
   }
      else
   {
      parent.doHotspotClick(2);
   }
}
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby PINGO TINTO » Tue May 31, 2011 9:24 pm

Lyberodoggy wrote:
Lyberodoggy wrote:Judging from the html code produced by the engine what you need to do is:

1) Create two hotspots, one that sends to the frame called adventuremaker014" and another to "adventuremaker012".
2)Overlap these hotspots with one bigger that does nothing in order to make them unclickable.
3)add this code to the html file (replace hotspot1 and hotspot2 with the actual integers that represent the hotspots' indices):

Code: Select all
if(fire1_on == 1){
parent.doHotspotClick(hotspot1);
}else{
parent.doHotspotClick(hotspot2);
}



4)Tell me if it actually worked.


Bumping my previous post:

actually to get it to work you need one minor adjustment.
Change this line:
<body bgcolor='000000' onLoad='parent.initializeFrame();'>
to
<body bgcolor='000000' onLoad='start()'>


Then go right above the </script> tag and add this code:

Code: Select all
function start(){
   parent.initializeFrame();
   if(fire1_on == 1)
   {
      parent.doHotspotClick(1);
   }
      else
   {
      parent.doHotspotClick(2);
   }
}


Hello
Lyderodoggy

I'm not able to do.
Can I send the HTML for your email? :arrow: lyberoskylo@hotmail.com
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Postby Lyberodoggy » Tue May 31, 2011 9:45 pm

You need to tell me what exactly should trigger this effect and how the fire1_on variable changes
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby PINGO TINTO » Tue May 31, 2011 9:58 pm

Lyberodoggy wrote:You need to tell me what exactly should trigger this effect and how the fire1_on variable changes


A friend of mine is trying to do like you said in the post before, if he don't succeed i'll post here more information about the problem
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Postby Lyberodoggy » Tue May 31, 2011 10:00 pm

ok.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby PINGO TINTO » Tue May 31, 2011 11:23 pm

Lyberodoggy wrote:ok.


I made ​​a video to try to explain my problem
:arrow: http://www.youtube.com/watch?v=bkABZKQKg2o

My English is very weak
Do not enjoy me :D
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Postby Lyberodoggy » Wed Jun 01, 2011 1:03 am

Now I see what you want.
It's done, but I think it could be done easier inside AM. Anyways I 've mailed back the project to you.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby PINGO TINTO » Wed Jun 01, 2011 2:15 am

Lyberodoggy wrote:Now I see what you want.
It's done, but I think it could be done easier inside AM. Anyways I 've mailed back the project to you.


Thank Lyderodoggy.
The oven is working very well.
Thank you very much
Within the game I get next to the fireplace a sign saying:

In case of damage contact Lyderdoggy:)
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Postby Lyberodoggy » Wed Jun 01, 2011 9:57 am

:D Thanks
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron