Closed cibersheep closed 7 years ago
Ok. I have doing some tests and it seams that this behaviour might be because /PRO 1 is not getting triggered. So, no list of objects in the location, no pictures and nothing that goes in.
I attach the file I'm working with. If you move from /PRO 1 to /PRO 0 (or to /PRO 2) the condition:
_ _
AT 0
works (even if BLOCK is called after first command). Am I doing something wrong?
Some clues: With this definitions
##define loc lFrontera 3
##define loc lCampo 4
....
##define loc lValleProf 25
##define loc lCanon 28
##define pic loc03.gif lFrontera
##define pic loc28.gif lCanon
I get this error:
Adding: 'loc03.gif'
Adding: 'loc28.gif'
#code.txi(7270):'ID duplicado':
7270, #ERROR: 'ID duplicado('loc28.gif' = 0, se encuentra repetido con 'loc03.gif')'.
If I replace the place names for their numbers the error disappears.
##define pic loc03.gif 3
##define pic loc28.gif 28
Ok. Some more info about this: I might found where is a problem: in line 18274 of the generated code.js we find:
function descriptionLoop()
{
do
{
describe_location_flag = false;
if (!getFlag(FLAG_MODE)) clearTextWindow();
if ((isDarkHere()) && (!lightObjectsPresent())) writeSysMessage(SYSMESS_ISDARK); else writeLocation(loc_here());
h_description_init();
playLocationMusic(loc_here());
if (loc_here()) drawPicture(loc_here()); else hideGraphicsWindow(); // Don't show picture at location 0
ACCminus(FLAG_AUTODEC2,1);
if (isDarkHere()) ACCminus(FLAG_AUTODEC3,1);
if ((isDarkHere()) && (lightObjectsAt(loc_here())==0)) ACCminus(FLAG_AUTODEC4,1);
callProcess(PROCESS_DESCRIPTION);
h_description_post();
if (describe_location_flag) continue; // descriptionLoop() again without nesting
describe_location_flag = false;
callProcess(PROCESS_TURN);
if (describe_location_flag) continue;
describe_location_flag = false;
focusInput();
break; // Dirty trick to make this happen just one, but many times if descriptioLoop() should be repeated
} while (true);
}
If we comment this line
//h_description_init();
everything get in its place: pictures show, objects in a locations get listed, language id detected, etc.
Making a search in the code I find that this functions gets defined in different lines: 13787 15282 15966 16112 16796 and it also might the source of the error shown in the console: Too much recursion.
The h_description_init() call is a hook (https://github.com/Utodev/ngPAWS/wiki/Hooks), meaning custom condacts made by third party may replace or chain into the hook call to do special things before location description happens. Thus, removing that call is not a good idea.
I've not been able to reproduce this behaviour with the code you have posted, everything seens to work fine on my side (although I had to add my own testing images of course).
Have you modified anything in the jsl folder? Otherwise, can you provide detais on which browser is being used and find a way to provide also the pictures?
Hi! I break down this issue in parts. a)
b) I started a project with images and blocks and pause condacts. I have observed:
c)
About commenting the h_description_init();
is just a dirty patch for the moment and to narrow down where it might be the issue.
I also managed to make the adventure work deleting all ¿redundant? code:
// Hook into location description to avoid video playing to continue playing while hidden after changing location
var old_youtube_h_description_init = h_description_init ;
var h_description_init = function ()
{
if ($("#youtube").length > 0) $("#youtube").remove();
old_youtube_h_description_init();
}
and
// Hook into keypress to cancel video playing if ESC is pressed and video is skippable
var old_video_h_keydown = h_keydown;
h_keydown = function (event)
{
if ((event.keyCode == 27) && (typeof videoElement != 'undefined') && (!videoElement.ended) && (videoEscapable))
{
videoElement.pause();
return false; // we've finished attending ESC press
}
else return old_video_h_keydown(event);
}
If I delete the code blocks starting in lines 15270, 16100, 16784, 16792 and leave the ones in 15954, 15962 (instead of commenting the main init), it also works.
d) I have observed in the javascript debugger, some errors in Firefox 52 and Chrome 56.0.2924.76 when typing.
too much recursion[Més informació] code.js:15701:1
h_keydown file:/// [...] code.js:15701:1
h_keydown file:/// [...] code.js:15966:15
about 130 times for every character pressed. Chrome expresses it as
Uncaught RangeError: Maximum call stack size exceeded
at h_keydown (code.js:15959)
at h_keydown (code.js:15715)
Does it make any sense? Sorry for being a bit messy
PS: I forgot to mention: I didn't change any of the jsl.
If you can't reproduce it with this project, and I know you don't have too much time now, could you compile the database.start and send it to me? In the only room should say that there's a torch. It doesn't say in mine... But if yo lu take all, it takes it
OK. Let's see if we can "take the cat out of the bag". I took source code from ngPAWS 9 beta. I have added a location and a picture (to location 1) to the dabase.start, added the connections and on location 1, two messages separated by a PAUSE. Compiled it from terminal and got the code.js. Opening index.html shows default location /0 on in the sea (no object list: should say "Puedes ver: una antorcha". Moving north only shows /1 description (it should also say "Frase 1. Haz un PAUSE 10 y..." and after PAUSE 5 "Acaba la frase" from condact in /PRO 1).
Tested on Ubuntu 16.04 Firefox, Ubuntu Touch Oxide (a fork of Chromium) and on Android (I had to add all external js and css in the test.html) with the same result. ngpaws_beta9_linux_x86_ES-aventura.tar.gz
Both on Chromium. Left with untouched code, right deleting the repeated code.
OK. It looks like the code from youtube.jsp and playvideo.jsp is responsible for the behaviour
This code.js works for me (look for //UTO ISSUE#11
).
I hope this helps. code.js.tar.gz
Hi, un update. I guess it's part of the same issue but with BLOCK, ANYKEY and QUIT the browser gets no keys pressed (you have to tap or click except with QUIT).
Deleting these blocks from code.js makes keys being detected again (on BLOCK, ANYKEY and QUIT) and error "too much recursion" is gone both in Firefox and Chromium
// Hook into keypress to cancel video playing if ESC is pressed and video is skippable
var old_video_h_keydown = h_keydown;
h_keydown = function (event)
{
if ((event.keyCode == 27) && (typeof videoElement != 'undefined') && (!videoElement.ended) && (videoEscapable))
{
videoElement.pause();
return false; // we've finished attending ESC press
}
else return old_video_h_keydown(event);
}
// hook replacement
var old_ask_h_keydown = h_keydown;
h_keydown = function (event)
{
if (inAsk)
{
var keyCodeAsChar = String.fromCharCode(event.keyCode).toLowerCase();
if (ask_responses.indexOf(keyCodeAsChar)!= -1)
{
setFlag(ask_flagno, ask_responses.indexOf(keyCodeAsChar));
inAsk = false;
event.preventDefault();
$('.input').show();
$('.input').focus();
hideBlock();
waitKeyCallback();
};
return false; // if we are in ASK condact, no keypress should be considered other than ASK response
} else return old_ask_h_keydown(event);
}
¡He encontrado qué pasa! (Well, at least the symptom).
After compiling the adventure, if you check my code.js has all the //CND sections duplicated.
Example:
23756 function ACChelp()
and
24608 function ACChelp()
See code.js here code.js.tar.gz
So, when plugins.js is build, the //CND are added twice in the same file... both using command line (ngpc) and IDE (ngpaws).
Are those responsible for this? condacto.c line 470 generar.c line 161
There may be a few different reasons for your game to have repeated condacts. ngPAWS loads plugin condacts from jsl folder located at ngpaws installation folder, that is, the folder quere the compiler (ngpc) is. It also load plugin condacts from "jsl" folder located where you .TXP source file is.
If by any change you have copied files in first folder to second one, you get the repeated. Also, if you take some .jsl file and make a copy with a different name, you get it copied also.
In my opinion, and with the information I have, that is just the resulting code but not the sources, I'd say you have built your game in some awkward way that is not expected by ngPAWS. My suggestion to avoid all that issues is you start a new game from the GUI, and name it however you prefer - i.e. "MYGAME" - when asked. Create it in a new folder you have just created.
Then you will find that folder has the usual "dat" folder, and a few files: buzz.js, css.css, index.html, jquery.js and MYGAME.TXP. Now get the .TXP file from your game an copy it to this folder as MYGAME.TXP (replace MYGAME.TXP). Then copy all images to dat folder.
From that moment on you are supposed to have a standar setup, use the GUI to compile and see what happens. You will NOT have a code.js file, but a MYGAME.js file.
If still you get condacts repeated, then delete your ngPAWS installation and start again.
If all that fails I would need the complete game, not just code.js, I can't see whats wrong without sources.
I see!
condacts from jsl folder located at ngpaws installation folder It also load plugin condacts from "jsl" folder located where you .TXP source file is.
And that is my error. I was compiling the game with my .txp file in the folder of the installation. And that's why the doubled condacts, I guess it is reading jsl folder twice.
I confirm that compiling the game with npgc and jsl/ in another folder makes all work great.
THANKS!!!
Yes, in that casethe compiler reads the folder twice, one cause it's in the compiler folder, and twice cause it's on the TXP folder. Did that fix the issue affecting you apart of removing the dupes?
I confirm that there's no bug ;) I have compiled the game from an independent folder and everything works: images, anykey keyboard strokes, no console errors...
In one word: all this thread it was because I was compiling code.txp that was in ngpc folder. Thanks and sorry
Good news then, nice we finally found the reason behind :-)
I don't know if I'm doing something wrong but adding:
##define pic l003.gif 1
to the code.txp doesn't find the picture under /dat folder. Plcing the image under root folder (ngpaws_beta9_linux_x86_ES
) solves the compiling error but pictures are not shown when opening index.html.I have tried it both with beta 9 and 10, compiling from the command line.