Page 33 of 121

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 2:00 am
by Nezhul
Thanks. Mine was simply a speed concern, but if it's memory then everything is good.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 3:01 am
by VanHellsing
I'm trying to make a tease using guideme and I have a question - why some gifs are much slower when they are played in GuideMe?

All of them have about 900kb-2mb, I tried downsizing them to 600kb and reducing number of colors but it didn't help. They work good when opened in browser, but GuideMe slows them down by a half or more. Other gifs with similar sizes work fine.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 7:39 am
by philo
VanHellsing wrote:I'm trying to make a tease using guideme and I have a question - why some gifs are much slower when they are played in GuideMe?

All of them have about 900kb-2mb, I tried downsizing them to 600kb and reducing number of colors but it didn't help. They work good when opened in browser, but GuideMe slows them down by a half or more. Other gifs with similar sizes work fine.
Gifs are rendered by the browser control which uses ie on windows, having done a bit of research on it recently it defaults to compatibility mode in later versions of ie (I think it gets the engine to mimic ie7).
I need to work out how to force it to not do that.
So my guess would be it is to do with that.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 10:07 am
by VanHellsing
philo wrote:Gifs are rendered by the browser control which uses ie on windows, having done a bit of research on it recently it defaults to compatibility mode in later versions of ie (I think it gets the engine to mimic ie7).
I need to work out how to force it to not do that.
So my guess would be it is to do with that.
Updating IE from 9 to 11 solved the problem. :)

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 2:51 pm
by Nezhul
As far as I know different gifs are encoded differently, so it has a lot to do with the bends in the arms of whoever made your gif.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 5:31 pm
by Nezhul
I have an XML like that:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?> <tdata>    <rare>3</rare>    <heat>80</heat>    <rate>3</rate></tdata>    <Tease scriptVersion="v0.1">  <Title>Sample Game</Title>  <Pages>          <Page id="Nezhul2Edging">         <Text>        </Text>                <Button target="EncasedTest">New random Image</Button>        <Button target="startreally">New random Image</Button>        <javascript>        <![CDATA[            function pageLoad()             {                fSelectImage();            }        ]]>        </javascript>    </Page>                  </Pages></Tease>
THis XML I want to include in a tease to get access to the pages in it, but also I need to store some data associated with it which I did in <tdata> block.
Now, how can I get the data from there? Or maybe I'm doing something essentially wrong?

Update: I don't know what went wrong, killed 2 hours trying to figure it out, ended up creating step-by-step a new file that LOOKS EXACTLY THE SAME but works. I guess I'll just link this video: http://www.youtube.com/watch?v=TqqB8NjcKJU

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Wed Feb 25, 2015 7:33 pm
by philo
Nezhul wrote:Update: I don't know what went wrong, killed 2 hours trying to figure it out, ended up creating step-by-step a new file that LOOKS EXACTLY THE SAME but works. I guess I'll just link this video: http://www.youtube.com/watch?v=TqqB8NjcKJU
Probably a non printable character somewhere, possibly a file encoding issue.
They are a pain to diagnose.

On a lighter note adding a forcestartpage node set to true, will force it to jump to the start page when you load the tease (but not clear any values).

Code: Select all

   <Settings>    <AutoSetPageWhenSeen>true</AutoSetPageWhenSeen>    <ForceStartPage>true</ForceStartPage>  </Settings> 

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Thu Feb 26, 2015 2:19 am
by Nezhul
A bug? The jar file that you send me earlier (the one with ListFiles() function) creates a file in the folder WHERE the folder with guideMe lies. So for example if I have
D:/Games/GuideMe
it will create a file in the folder
D:/Games

The file is called: "GuideMe v0.1.2;tmpImage.jpg" and is basically the last viewed image of the tease.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Thu Feb 26, 2015 2:27 pm
by Nezhul
I need to get a number of MINUTES that have past since I started session. Even if this number is greater than 60, I don't want hours, I want minutes. Like "87 minutes". How do I do that?

The only solution I thought of is:

Code: Select all

 // vStartTime was saved at the start of the session via Date.getTime() var dateobj = new Date();var curTime = dateobj.getTime();                   //returns number of milliseconds since 01.01.1970var startTime = parseInt(scriptVars.get("vStartTime"));var minutesPast = (curTime - startTime)/60000;                  //I assume there's 60 seconds in a minute and                                                                                        // 1000 milliseconds in a second 
Right? Or is there a better way?


also what type of comment signs are good for your CDATA block?

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Thu Feb 26, 2015 5:02 pm
by Nezhul
Nezhul wrote:I have an XML like that:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?> <tdata>    <rare>3</rare>    <heat>80</heat>    <rate>3</rate></tdata>    <Tease scriptVersion="v0.1">  <Title>Sample Game</Title>  <Pages>          <Page id="Nezhul2Edging">         <Text>        </Text>                <Button target="EncasedTest">New random Image</Button>        <Button target="startreally">New random Image</Button>        <javascript>        <![CDATA[            function pageLoad()             {                fSelectImage();            }        ]]>        </javascript>    </Page>                  </Pages></Tease>
THis XML I want to include in a tease to get access to the pages in it, but also I need to store some data associated with it which I did in <tdata> block.
Now, how can I get the data from there? Or maybe I'm doing something essentially wrong?

Update: I don't know what went wrong, killed 2 hours trying to figure it out, ended up creating step-by-step a new file that LOOKS EXACTLY THE SAME but works. I guess I'll just link this video: http://www.youtube.com/watch?v=TqqB8NjcKJU
About this thing again, it's really really weird. I use Notepad++ to edit my files. Now if I create a brand new XML file, open it and edit it, then upon hitting "Enter" the invisible signs at the end of the line are [CR][LF].

However some files I used _Tutorial.xml made by d3vion as template, simply copying it and removing all the pages and unnecessary data. In THESE files each line ends with only [LF] and I couldn't make it to show [CR] whatever I did.

Now, files with [CR][LF] are parsed good when attempting to extract tag data from them, but files with just [LF] are bad, and I couldn't get the data from them. So yea, if anyone has a guess what this is, let me know. :closedeyes:

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Thu Feb 26, 2015 6:06 pm
by Nezhul
Another "sorta" bug.
I have an array of objects. I store it in with scriptVars.put(). However if there are errors in the objects, the data will not be written to .state file.

For example I had this code to fill up the array:

Code: Select all

TempXML.name = fnames[i].substring(0,fnames[i].lastIndexOf(".xml"));                    TempXML.age = 0;TempXML.minmood = xmlobj.tdata.minmood[0];TempXML.maxmood = xmlobj.tdata.maxmood[0];realXMLs.push(TempXML); 
However my mistake was that xmlobj.tdata.minmood[0] returned string, while TempXML.minmood was int. This resulted in TempXML.minmood being "null". And an array with such values cannot be stored in the state file (which is odd, but OK).
As soon as I chaged to

Code: Select all

TempXML.name = fnames[i].substring(0,fnames[i].lastIndexOf(".xml"));                    TempXML.age = 0;TempXML.minmood = parseInt(xmlobj.tdata.minmood[0]);TempXML.maxmood = parseInt(xmlobj.tdata.maxmood[0]);realXMLs.push(TempXML); 
everything worked.

But that's not the real issue. The real issue is that even that nothing was saved to .state file, because GuideMe grabs vars from RAM rather than from file, next time I used scriptVars.get("XMLarray"); I actually got my array of objects back. That is working while I'm in the process of playing, but next time I start I get "raw" array again with default XML data rather than whatever I changed there during gameplay.

This bug is confusing, more than it is in the way. You can live with it (just make everything right), but it sucked to figure out the problem.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Thu Feb 26, 2015 7:30 pm
by philo
Nezhul wrote:also what type of comment signs are good for your CDATA block?
Not sure what you mean.
A CDATA block is used to tell xml to ignore the contents and don't try and treat it as xml.
For the javascript CDATA section everything is treated as javascript so the standard javascript comments should work.

On the date/time difference I will add a new function to comonFunctions.
It will return days, hours, minutes or seconds between 2 dates

Code: Select all

             var dateobj1 = new Date();            jscriptLog(dateobj1);            var dateobj2 = new Date();            jscriptLog(dateobj2);            dateobj2 = new Date(dateobj2.getTime() + 129600000);             jscriptLog(dateobj2);            var intDiffd = comonFunctions.dateDifference("d", dateobj1, dateobj2);            jscriptLog(intDiffd);            var intDiffh = comonFunctions.dateDifference("h", dateobj1, dateobj2);            jscriptLog(intDiffh);            var intDiffm = comonFunctions.dateDifference("m", dateobj1, dateobj2);            jscriptLog(intDiffm);            var intDiffs = comonFunctions.dateDifference("s", dateobj1, dateobj2);            jscriptLog(intDiffs); 
On the lf / crlf issue some editors only write an lf, which would be why you are not seeing the cr.
It sounds like encoding issues which are always a pain.
Nezhul wrote:Another "sorta" bug.
The description didn't really make sense, without seeing the full code on what you are doing I don't think I can help.
There are incompatibilities between java and javascript variables, so there are some fixes I had to do to get the state to store correctly. But without seeing the full code it is not clear what you are actually trying to do.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Fri Feb 27, 2015 4:23 pm
by Nezhul
I have a slight problem that doesn't ruin my life but makes me find solutions in a very deep butthole....

the problem is, splice() and shift() for array don't change it's length. In other words

Code: Select all

var x = ["a","b","c"]var y = x.splice(0,1)            //y == ["b","c","c"]    , y.length == 3
That I cannot understand.

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Fri Feb 27, 2015 9:08 pm
by philo
Nezhul wrote:I have a slight problem that doesn't ruin my life but makes me find solutions in a very deep butthole....

the problem is, splice() and shift() for array don't change it's length. In other words

Code: Select all

var x = ["a","b","c"]var y = x.splice(0,1)            //y == ["b","c","c"]    , y.length == 3
That I cannot understand.
It worked fine for me

Code: Select all

//setup arrayvar x = ["a","b","c"];jscriptLog("x: " + x);jscriptLog("x.length: " + x.length);// grab the "a" from the array and put in yvar y = x.shift();jscriptLog("x: " + x);jscriptLog("x.length: " + x.length);jscriptLog("y: " + y);//grab the "c" from the array and put it in zvar z = x.splice(1,1);jscriptLog("x: " + x);jscriptLog("x.length: " + x.length);jscriptLog("z: " + z);// add 2 new values to the arrayx.splice(1,0,"d","e");jscriptLog("x: " + x);jscriptLog("x.length: " + x.length); 

Code: Select all

2015-02-27 21:02:59,597 INFO  Jscript - x: a,b,c2015-02-27 21:02:59,597 INFO  Jscript - x.length: 32015-02-27 21:02:59,598 INFO  Jscript - x: b,c2015-02-27 21:02:59,598 INFO  Jscript - x.length: 22015-02-27 21:02:59,598 INFO  Jscript - y: a2015-02-27 21:02:59,598 INFO  Jscript - x: b2015-02-27 21:02:59,598 INFO  Jscript - x.length: 12015-02-27 21:02:59,598 INFO  Jscript - z: c2015-02-27 21:02:59,599 INFO  Jscript - x: b,d,e2015-02-27 21:02:59,599 INFO  Jscript - x.length: 3

Re: GuideMe (TeaseMe v2.0): BETA Thread

Posted: Sat Feb 28, 2015 2:32 am
by Nezhul
Strange. Well I don't have exactly the same code, I have an array of strings.