GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Webteases are great, but what if you're in the mood for a slightly more immersive experience? Chat about Tease AI and other offline tease software.

Moderator: 1885

RemiHiyama
Explorer At Heart
Explorer At Heart
Posts: 203
Joined: Thu Feb 28, 2019 3:30 pm
I am a: Switch

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by RemiHiyama »

FCK88 wrote: Tue Feb 15, 2022 1:54 pmThe problem is - what I posted in my earlier post is all I got from the guideme.log-file.. I don't have anything that says "Exception" or any of the other things you mention.. :unsure:
Ah, okay. So you've got a really early crash. That's usually caused by missing files in my experience, but from what you've said you must have downloaded the full version, so that shouldn't be an issue.

Okay, how about this, I realized what I said to do before wouldn't have worked. Make a copy of start.bat, change "start javaw" to "java", and run that from a command prompt, and see what comes up. If there's a problem happening before GuideMe's logging kicks in, that should show it.
Auto: Replaces selected instances of the word "not" with the word "definitely".
User avatar
FCK88
Explorer At Heart
Explorer At Heart
Posts: 141
Joined: Tue Mar 26, 2013 8:29 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch
Location: Silkeborg, Denmark

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by FCK88 »

RemiHiyama wrote: Tue Feb 15, 2022 5:47 pm
FCK88 wrote: Tue Feb 15, 2022 1:54 pmThe problem is - what I posted in my earlier post is all I got from the guideme.log-file.. I don't have anything that says "Exception" or any of the other things you mention.. :unsure:
Ah, okay. So you've got a really early crash. That's usually caused by missing files in my experience, but from what you've said you must have downloaded the full version, so that shouldn't be an issue.

Okay, how about this, I realized what I said to do before wouldn't have worked. Make a copy of start.bat, change "start javaw" to "java", and run that from a command prompt, and see what comes up. If there's a problem happening before GuideMe's logging kicks in, that should show it.
I did try out your trick and it showed a lot of lines with some error messages I think but it all went so fast so I didn't even get to see what happened or what was wrong.. :unsure:
RemiHiyama
Explorer At Heart
Explorer At Heart
Posts: 203
Joined: Thu Feb 28, 2019 3:30 pm
I am a: Switch

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by RemiHiyama »

FCK88 wrote: Tue Feb 15, 2022 6:00 pmI did try out your trick and it showed a lot of lines with some error messages I think but it all went so fast so I didn't even get to see what happened or what was wrong.. :unsure:
Were you running it in a command prompt? That part's important. If you just double-click on it, it'll close the window as soon as it's done instead of letting you scroll up and see what happened.

(You can also add a line with "pause" to the end of the batch file, but that doesn't always work well.)
Auto: Replaces selected instances of the word "not" with the word "definitely".
User avatar
FCK88
Explorer At Heart
Explorer At Heart
Posts: 141
Joined: Tue Mar 26, 2013 8:29 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch
Location: Silkeborg, Denmark

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by FCK88 »

RemiHiyama wrote: Tue Feb 15, 2022 6:39 pm
FCK88 wrote: Tue Feb 15, 2022 6:00 pmI did try out your trick and it showed a lot of lines with some error messages I think but it all went so fast so I didn't even get to see what happened or what was wrong.. :unsure:
Were you running it in a command prompt? That part's important. If you just double-click on it, it'll close the window as soon as it's done instead of letting you scroll up and see what happened.

(You can also add a line with "pause" to the end of the batch file, but that doesn't always work well.)
Yes I ran it in command prompt.
RemiHiyama
Explorer At Heart
Explorer At Heart
Posts: 203
Joined: Thu Feb 28, 2019 3:30 pm
I am a: Switch

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by RemiHiyama »

FCK88 wrote: Tue Feb 15, 2022 6:45 pmYes I ran it in command prompt.
Well, if you've got it running in a command prompt and you're seeing messages, but it's not letting you scroll up to see them, then I'm just stumped.
Auto: Replaces selected instances of the word "not" with the word "definitely".
EroticDevelopment
Explorer
Explorer
Posts: 36
Joined: Thu Oct 15, 2020 3:32 am
Gender: Male
Sexual Orientation: Straight
Location: USA

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by EroticDevelopment »

RemiHiyama wrote: Wed Feb 16, 2022 6:57 am
FCK88 wrote: Tue Feb 15, 2022 6:45 pmYes I ran it in command prompt.
Well, if you've got it running in a command prompt and you're seeing messages, but it's not letting you scroll up to see them, then I'm just stumped.
It's doing that because of the "start" command in the bat file. "start" causes the command being called (javaw) to replace the current process (command prompt), so when Java(w) crashes the prompt closes.

FCK88, try this. Replace your start.bat with the following (or put this in a new debug.bat). The command prompt should stay open, and you can copy/paste the error message. Feel free to sanitize any personal info as before. We're going to want the last handful of lines following Remi's description from before. Scroll up from the bottom, find the first line that has some kind of "Exception", and grab everything below that.

Code: Select all

@echo off
PATH=./java/bin;./lib;%PATH%
java -Xms1024m -Xmx1024m -jar GuideMe.jar
pause
This looks to be a very early crash, possibly before much of the logging is initialized which is odd.
User avatar
FCK88
Explorer At Heart
Explorer At Heart
Posts: 141
Joined: Tue Mar 26, 2013 8:29 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch
Location: Silkeborg, Denmark

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by FCK88 »

EroticDevelopment wrote: Fri Feb 18, 2022 4:20 am
RemiHiyama wrote: Wed Feb 16, 2022 6:57 am
FCK88 wrote: Tue Feb 15, 2022 6:45 pmYes I ran it in command prompt.
Well, if you've got it running in a command prompt and you're seeing messages, but it's not letting you scroll up to see them, then I'm just stumped.
It's doing that because of the "start" command in the bat file. "start" causes the command being called (javaw) to replace the current process (command prompt), so when Java(w) crashes the prompt closes.

FCK88, try this. Replace your start.bat with the following (or put this in a new debug.bat). The command prompt should stay open, and you can copy/paste the error message. Feel free to sanitize any personal info as before. We're going to want the last handful of lines following Remi's description from before. Scroll up from the bottom, find the first line that has some kind of "Exception", and grab everything below that.

Code: Select all

@echo off
PATH=./java/bin;./lib;%PATH%
java -Xms1024m -Xmx1024m -jar GuideMe.jar
pause
This looks to be a very early crash, possibly before much of the logging is initialized which is odd.
Hey ED.

I got it working now - seems all I had to do was delete the startup.state-file in my Data folder and then all of a sudden, BOOM - it worked :-D

But now, of course, I've encountered a NEW problem(sorry for being an annoying a** :blush: ).. When I used the MiloDownloader that supports downloading EOS teases I don't get shown any pics in GuideMe.. Maybe you know a solution to that problem as well?

Thanks in advance :-)

FCK88
RemiHiyama
Explorer At Heart
Explorer At Heart
Posts: 203
Joined: Thu Feb 28, 2019 3:30 pm
I am a: Switch

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by RemiHiyama »

EroticDevelopment wrote: Fri Feb 18, 2022 4:20 am put this in a new debug.bat).
Maybe we should consider adding this to the build?

Anyway, yeah, the problem was that issue that shows up periodically where startup.state ends up containing something like this:

Code: Select all

<scope><![CDATA[ignore]]></scope>
And then when the GuideSettings constructor is run, ComonFunctions.getSavedObject hits an error trying to turn "ignore" into a Scriptable, and then because of the way the exception is handling it just returns the string "ignore". Then it tries to cast that into a Scriptable object that fails and nothing catches the exception.

I'm not really sure of the best way to handle this.
Auto: Replaces selected instances of the word "not" with the word "definitely".
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1068
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by PlayfulGuy »

ashikoki wrote: Mon Feb 14, 2022 5:12 pm Hello, does this currently work with GuideMe? https://milovana.com/webteases/showtease.php?id=52907
I only get a black screen when trying to load the XML file.

Edit: I've tried another tease and it loaded and worked just fine.
No it doesn't. There's some odd code in that one that the downloader doesn't convert properly.
It's on my list.

And please post questions related to the downloader in that thread so I can more easily keep track.
Link in my signature.

PG
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1068
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by PlayfulGuy »

FCK88 wrote: Fri Feb 18, 2022 4:31 am
But now, of course, I've encountered a NEW problem(sorry for being an annoying a** :blush: ).. When I used the MiloDownloader that supports downloading EOS teases I don't get shown any pics in GuideMe.. Maybe you know a solution to that problem as well?

Thanks in advance :-)

FCK88
Please post in the Downloader thread (link below) with info on the tease or teases you tried to download. I've not encountered that issue with any teases.

PG
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1068
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by PlayfulGuy »

FCK88 wrote: Fri Feb 18, 2022 4:31 am
But now, of course, I've encountered a NEW problem(sorry for being an annoying a** :blush: ).. When I used the MiloDownloader that supports downloading EOS teases I don't get shown any pics in GuideMe.. Maybe you know a solution to that problem as well?

Thanks in advance :-)

FCK88
I believe I ran across the tease you had this issue with. Is it this one (number 54718) published recently that has the name and everything in all asian characters?
There was a unique problem in the conversion of that one caused by the language characters. It's fixed in the new version of the downloader (version 0.96c) which I uploaded yesterday.

Cheers!

PG
User avatar
FCK88
Explorer At Heart
Explorer At Heart
Posts: 141
Joined: Tue Mar 26, 2013 8:29 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch
Location: Silkeborg, Denmark

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by FCK88 »

PlayfulGuy wrote: Mon Feb 21, 2022 10:21 pm
FCK88 wrote: Fri Feb 18, 2022 4:31 am
But now, of course, I've encountered a NEW problem(sorry for being an annoying a** :blush: ).. When I used the MiloDownloader that supports downloading EOS teases I don't get shown any pics in GuideMe.. Maybe you know a solution to that problem as well?

Thanks in advance :-)

FCK88
I believe I ran across the tease you had this issue with. Is it this one (number 54718) published recently that has the name and everything in all asian characters?
There was a unique problem in the conversion of that one caused by the language characters. It's fixed in the new version of the downloader (version 0.96c) which I uploaded yesterday.

Cheers!

PG
Hey - no it was an older tease called Gynocracy Prison by Kerkersklave.. But after I downloaded the newest version of the Milodownloader it downloaded just fine(somehow my antivirus blocked the access to a file called beta.jpg and when I gave the program the green light to bypass the detection of files like that it suddenly downloaded like it should :-P )
wheresmything
Explorer
Explorer
Posts: 62
Joined: Tue Nov 16, 2010 2:02 pm

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by wheresmything »

Going bonkers with parseInt, would appreciate assistance. I've greatly abbreviated the script below while trying to retain it well enough to see what's going on. The challenge I'm having is that I've added a variable "vModifier" as the last bit of the global java. Everywhere it is called, I see the correct value, and on the "Ask" page the math works with the random value and vModifier being added together as intended.

Where I'm running into trouble is that I would like to update the vModifier on the Allow, Ruin, and No pages by a static amount (i.e vModifier + 3) and no matter how I try, the math doesn't work (I've tried many different parseInts, along with static numbers, variabilized increments, etc). I'd also want that value to be persisent throughout the session (resetting only on a new session or restart).

So if anyone could help me work out how to have the value of vModifier be 0 on startup, and then add a number to it (that then remains as an offset) when it hits any of the Allow, Ruin, or No pages, I'd really appreciate it.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<Tease>
  <Title>At thier whim v11</Title>
  <Author id="">
    <Name>""</Name>
  </Author>

  <MediaDirectory>At thier whim</MediaDirectory>

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

  <GlobalJavascript>
  <![CDATA[

    //Difficulty settings: Very Easy = 0, Easy = 1, Medium = 2, Hard = 3, Very Hard = 4, Insane = 5, TESTING = 6
	var arrayModel = [
		{ Name: "TEST", 	sortOrder:  999, Sets: [
			{Difficulty: 6, Path: "Test\\Test-1" },
			{Difficulty: 6, Path: "Test\\Test-2" },
			{Difficulty: 6, Path: "Test\\Test-3" },
			{Difficulty: 6, Path: "Test\\Test-4" },
			{Difficulty: 6, Path: "Test\\Test-5" },
			{Difficulty: 6, Path: "Test\\Test-6" }]},
		];

	//Time is in seconds
	var arrayDifficulty = [
		{ Level: "Very Easy", 	DelayMin: 0, 	DelayMax: 0, AllowChance: 0, RuinChance: 0},
		{ Level: "Easy", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, RuinChance: 0},
		{ Level: "Medium", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, RuinChance: 0},
		{ Level: "Hard", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, 	RuinChance: 0},
		{ Level: "Very Hard", 	DelayMin: 0, 	DelayMax: 0, AllowChance: 0, 	RuinChance: 0},
		{ Level: "Insane", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, 	RuinChance: 0},
		{ Level: "TEST", 		DelayMin: 3, 	DelayMax: 3, AllowChance: 33, 	RuinChance: 33},
	];

	var arrayAllow = [
		"yes",
	];
	
	var arrayRuin = [
		"oops",
	];

	var arrayDeny = [
		"no",
	];
	
	var vModifier = 0;  //Modifier adds to the "Ask" roll, slowly increasing the chance of success with each model
	
]]>
  </GlobalJavascript>

  <Pages>
    <Page id="start">
      <Text>Who'd you like to see?</Text>
      <Image id="Welcome.jpg" />
      <javascript>
		  <![CDATA[
		  function pageLoad() {
  			var i = 0;
  			var vSelected = parseInt(scriptVars.get("vSelected"),10);
			

  			jscriptLog("vSelected = " + vSelected);
  			if ( isNaN(vSelected) || vSelected == undefined ) {
  			  vSelected = 0;
  			  scriptVars.put("vSelected", vSelected);
  			  jscriptLog("vSelected initialized to " + vSelected);
  			}

			for (i=0; i < arrayModel.length; i++) {
				var vName = arrayModel[i].Name;
				var vSort = arrayModel[i].sortOrder.toString();		//sortOrder parameter needs to be a string
				overRide.addButton("Confirm", vName, "", "", "setModel(" + i +")", "", "", vSort, false, "");
			}
			
			var i = parseInt(scriptVars.get("vSelected"),10);

  			overRide.setHtml("Who'd you like to see this time?  <br/>Last time you visited " + arrayModel[vSelected].Name + "<br/><br/>Current modifier value = " + vModifier);
			overRide.addButton("Confirm", "Revist Last", "", "", "setModel(" + i +")", "", "", "", false, "");
			overRide.addButton("Confirm", "You Choose", "", "", "setRandomModel()", "", "");
			}

			function setModel(i)
			{
				scriptVars.put("vSelected", i);

				// And randomly select a set to use and save this for other pages to access
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet);  
			}
			
			function setRandomModel()
			{
				var i = Math.floor(Math.random()*arrayModel.length);
				
				scriptVars.put("vSelected", i);
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet); 
			}
		  ]]>
	  </javascript>
    </Page>

	<Page id="Confirm">
      <Text>Seeing this means something went wrong on the page - Confirm</Text>
	  <Image id="test.jpg" />
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
					var vDiff = arrayModel[i].Sets[vSet].Difficulty;
					var vLvl = arrayDifficulty[vDiff].Level;

					var text = arrayModel[i].Name + ":<br/>Are you ready to begin?<br/><br/>";

			  overRide.setHtml(text);
			  overRide.image = vPath + "/ready.jpg";

				}

			]]>
		</javascript>

	<Button target="start">Someone Else</Button>
	<Button target="ChangeSet">Different Set</Button>
	<Button target="Wait">Let's Begin</Button>
	</Page>

	<Page id="ChangeSet">
      <Text>Seeing this means something went wrong on the page - ChangeSet</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
				
				var i = parseInt(scriptVars.get("vSelected"),10);
				scriptVars.put("vSelected", i);
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet);  
				}
			]]>
		</javascript>
	<Delay seconds="0" target="Confirm" style="hidden"/>
	</Page>
	
	<Page id="Retry">
      <Text>Seeing this means something went wrong on the page - ChangeSet</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
				
				var i = parseInt(scriptVars.get("vSelected"),10);
				scriptVars.put("vSelected", i);
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet);  
				var vPath = arrayModel[i].Sets[vSet].Path;
				var vDiff = arrayModel[i].Sets[vSet].Difficulty;
				var vLvl = arrayDifficulty[vDiff].Level;				
				}
			]]>
		</javascript>
	<Delay seconds="0" target="Wait" style="hidden"/>
	</Page>
	
	<Page id="Wait">
      <Text>Seeing this means something went wrong on the page - Wait</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
					var vDiff = arrayModel[i].Sets[vSet].Difficulty;
					
					var vMinDel = arrayDifficulty[vDiff].DelayMin;
					var vMaxDel = arrayDifficulty[vDiff].DelayMax;

					var vDelay = Math.floor(Math.random() * (vMaxDel - vMinDel + 1)) + vMinDel;

			  overRide.setHtml(arrayModel[i].Name + ":  Waiting...");
			  overRide.image = vPath + "/Wait/*.jpg";
			  overRide.setDelay("Ask", vDelay, "", "hidden", "", "", "");

				}

			]]>
		</javascript>
  	  <!-- <Button target="Ask">proceed-test</Button> -->
	</Page>
	
	
	<Page id="Ask">
      <Text>Seeing this means something went wrong on the page - Ask</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);

					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
					var vDiff = arrayModel[i].Sets[vSet].Difficulty;

					var vAllowCase = 100 - parseInt(arrayDifficulty[vDiff].AllowChance,10);
					var vRuinCase = vAllowCase - parseInt(arrayDifficulty[vDiff].RuinChance,10);

				    var rand = guide.getRandom("(1..100)");
					var roll = rand + vModifier;
					
					
				  switch (true)
					{
					 case roll > vAllowCase:
						overRide.addButton("Allow", "Please...", "", "", "", "", "");
						break;
					 case roll > vRuinCase:
						overRide.addButton("Ruin", "Please...", "", "", "", "", "");
						break;
					default:
						overRide.addButton("No", "Please...", "", "", "", "", "");
					}

				    overRide.setHtml("Ask nicely" + "  " + rand + "-" + vModifier + "-" + roll);
				    overRide.image = vPath + "/Ask/*.jpg";

				}

			]]>
		</javascript>
    </Page>
	
	<Page id="Allow">
      <Text>Seeing this means something went wrong on the page - Allow</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;

					var vResponse = arrayModel[i].Name + ": " + arrayAllow[Math.floor(Math.random()*arrayAllow.length)];

			  overRide.setHtml(vResponse + " - " + vModifier);
			  overRide.image = vPath + "/Yes/*.jpg";

				}

			]]>
		</javascript>
	  <Button target="start">Someone else?</Button>
	  <Button target="Retry">Try Again?</Button>
    </Page>	

	<Page id="Ruin">
      <Text>Seeing this means something went wrong on the page - Ruin</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;

					var vResponse = arrayModel[i].Name + ": " + arrayRuin[Math.floor(Math.random()*arrayRuin.length)];

			  overRide.setHtml(vResponse + " - " + vModifier);
			  overRide.image = vPath + "/No/*.jpg";

				}

			]]>
		</javascript>
	  <Button target="start">Someone else?</Button>
	  <Button target="Retry">Try Again?</Button>
    </Page>	
	
	<Page id="No">
      <Text>Seeing this means something went wrong on the page - No</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
										
					var vResponse = arrayModel[i].Name + ": " + arrayDeny[Math.floor(Math.random()*arrayDeny.length)];

			  overRide.setHtml(vResponse + " - " + vModifier);
			  overRide.image = vPath + "/No/*.jpg";

				}

			]]>
		</javascript>
      <Button target="start">Someone else?</Button>
	  <Button target="Retry">Try Again?</Button>
	</Page>	
	
  </Pages>
</Tease>
RemiHiyama
Explorer At Heart
Explorer At Heart
Posts: 203
Joined: Thu Feb 28, 2019 3:30 pm
I am a: Switch

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by RemiHiyama »

wheresmything wrote: Tue Feb 22, 2022 1:55 am Going bonkers with parseInt, would appreciate assistance.
You seem to be using parseInt some places where it shouldn't actually be necessary. For instance, if you use the debug shell, you can see that the values in the vSelected and vSet scriptvars are already stored as numbers, so reparsing them is unnecessary - Javascript is just going to turn them into a string and back, so basically it's doing nothing.

As for vModifier, since you don't appear to be storing it's value in a scriptvar when it changes and then retrieving it when you need it, it's going to be reset to 0 whenever you go to a new page or otherwise run a javascript function.

If that doesn't sound like how a variable defined in GlobalJavascript should work... welcome to GuideMe. It used to work differently but now it works like this. Every time you run a javascript function, it starts with a mostly-fresh context, runs your global javascript, runs your page javascript, and then calls whatever function you asked it for. Does this make doing complicated logic with a lot of variables obnoxious? Why yes, yes it does.
Auto: Replaces selected instances of the word "not" with the word "definitely".
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1068
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: GuideMe (TeaseMe v2.0) - Current Build 0.4.4

Post by PlayfulGuy »

wheresmything wrote: Tue Feb 22, 2022 1:55 am Going bonkers with parseInt, would appreciate assistance. I've greatly abbreviated the script below while trying to retain it well enough to see what's going on. The challenge I'm having is that I've added a variable "vModifier" as the last bit of the global java. Everywhere it is called, I see the correct value, and on the "Ask" page the math works with the random value and vModifier being added together as intended.

Where I'm running into trouble is that I would like to update the vModifier on the Allow, Ruin, and No pages by a static amount (i.e vModifier + 3) and no matter how I try, the math doesn't work (I've tried many different parseInts, along with static numbers, variabilized increments, etc). I'd also want that value to be persisent throughout the session (resetting only on a new session or restart).

So if anyone could help me work out how to have the value of vModifier be 0 on startup, and then add a number to it (that then remains as an offset) when it hits any of the Allow, Ruin, or No pages, I'd really appreciate it.
Spoiler: show

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<Tease>
  <Title>At thier whim v11</Title>
  <Author id="">
    <Name>""</Name>
  </Author>

  <MediaDirectory>At thier whim</MediaDirectory>

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

  <GlobalJavascript>
  <![CDATA[

    //Difficulty settings: Very Easy = 0, Easy = 1, Medium = 2, Hard = 3, Very Hard = 4, Insane = 5, TESTING = 6
	var arrayModel = [
		{ Name: "TEST", 	sortOrder:  999, Sets: [
			{Difficulty: 6, Path: "Test\\Test-1" },
			{Difficulty: 6, Path: "Test\\Test-2" },
			{Difficulty: 6, Path: "Test\\Test-3" },
			{Difficulty: 6, Path: "Test\\Test-4" },
			{Difficulty: 6, Path: "Test\\Test-5" },
			{Difficulty: 6, Path: "Test\\Test-6" }]},
		];

	//Time is in seconds
	var arrayDifficulty = [
		{ Level: "Very Easy", 	DelayMin: 0, 	DelayMax: 0, AllowChance: 0, RuinChance: 0},
		{ Level: "Easy", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, RuinChance: 0},
		{ Level: "Medium", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, RuinChance: 0},
		{ Level: "Hard", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, 	RuinChance: 0},
		{ Level: "Very Hard", 	DelayMin: 0, 	DelayMax: 0, AllowChance: 0, 	RuinChance: 0},
		{ Level: "Insane", 		DelayMin: 0, 	DelayMax: 0, AllowChance: 0, 	RuinChance: 0},
		{ Level: "TEST", 		DelayMin: 3, 	DelayMax: 3, AllowChance: 33, 	RuinChance: 33},
	];

	var arrayAllow = [
		"yes",
	];
	
	var arrayRuin = [
		"oops",
	];

	var arrayDeny = [
		"no",
	];
	
	var vModifier = 0;  //Modifier adds to the "Ask" roll, slowly increasing the chance of success with each model
	
]]>
  </GlobalJavascript>

  <Pages>
    <Page id="start">
      <Text>Who'd you like to see?</Text>
      <Image id="Welcome.jpg" />
      <javascript>
		  <![CDATA[
		  function pageLoad() {
  			var i = 0;
  			var vSelected = parseInt(scriptVars.get("vSelected"),10);
			

  			jscriptLog("vSelected = " + vSelected);
  			if ( isNaN(vSelected) || vSelected == undefined ) {
  			  vSelected = 0;
  			  scriptVars.put("vSelected", vSelected);
  			  jscriptLog("vSelected initialized to " + vSelected);
  			}

			for (i=0; i < arrayModel.length; i++) {
				var vName = arrayModel[i].Name;
				var vSort = arrayModel[i].sortOrder.toString();		//sortOrder parameter needs to be a string
				overRide.addButton("Confirm", vName, "", "", "setModel(" + i +")", "", "", vSort, false, "");
			}
			
			var i = parseInt(scriptVars.get("vSelected"),10);

  			overRide.setHtml("Who'd you like to see this time?  <br/>Last time you visited " + arrayModel[vSelected].Name + "<br/><br/>Current modifier value = " + vModifier);
			overRide.addButton("Confirm", "Revist Last", "", "", "setModel(" + i +")", "", "", "", false, "");
			overRide.addButton("Confirm", "You Choose", "", "", "setRandomModel()", "", "");
			}

			function setModel(i)
			{
				scriptVars.put("vSelected", i);

				// And randomly select a set to use and save this for other pages to access
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet);  
			}
			
			function setRandomModel()
			{
				var i = Math.floor(Math.random()*arrayModel.length);
				
				scriptVars.put("vSelected", i);
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet); 
			}
		  ]]>
	  </javascript>
    </Page>

	<Page id="Confirm">
      <Text>Seeing this means something went wrong on the page - Confirm</Text>
	  <Image id="test.jpg" />
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
					var vDiff = arrayModel[i].Sets[vSet].Difficulty;
					var vLvl = arrayDifficulty[vDiff].Level;

					var text = arrayModel[i].Name + ":<br/>Are you ready to begin?<br/><br/>";

			  overRide.setHtml(text);
			  overRide.image = vPath + "/ready.jpg";

				}

			]]>
		</javascript>

	<Button target="start">Someone Else</Button>
	<Button target="ChangeSet">Different Set</Button>
	<Button target="Wait">Let's Begin</Button>
	</Page>

	<Page id="ChangeSet">
      <Text>Seeing this means something went wrong on the page - ChangeSet</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
				
				var i = parseInt(scriptVars.get("vSelected"),10);
				scriptVars.put("vSelected", i);
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet);  
				}
			]]>
		</javascript>
	<Delay seconds="0" target="Confirm" style="hidden"/>
	</Page>
	
	<Page id="Retry">
      <Text>Seeing this means something went wrong on the page - ChangeSet</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
				
				var i = parseInt(scriptVars.get("vSelected"),10);
				scriptVars.put("vSelected", i);
				var vSet = Math.floor(Math.random()*arrayModel[i].Sets.length);
				scriptVars.put("vSet", vSet);  
				var vPath = arrayModel[i].Sets[vSet].Path;
				var vDiff = arrayModel[i].Sets[vSet].Difficulty;
				var vLvl = arrayDifficulty[vDiff].Level;				
				}
			]]>
		</javascript>
	<Delay seconds="0" target="Wait" style="hidden"/>
	</Page>
	
	<Page id="Wait">
      <Text>Seeing this means something went wrong on the page - Wait</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
					var vDiff = arrayModel[i].Sets[vSet].Difficulty;
					
					var vMinDel = arrayDifficulty[vDiff].DelayMin;
					var vMaxDel = arrayDifficulty[vDiff].DelayMax;

					var vDelay = Math.floor(Math.random() * (vMaxDel - vMinDel + 1)) + vMinDel;

			  overRide.setHtml(arrayModel[i].Name + ":  Waiting...");
			  overRide.image = vPath + "/Wait/*.jpg";
			  overRide.setDelay("Ask", vDelay, "", "hidden", "", "", "");

				}

			]]>
		</javascript>
  	  <!-- <Button target="Ask">proceed-test</Button> -->
	</Page>
	
	
	<Page id="Ask">
      <Text>Seeing this means something went wrong on the page - Ask</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);

					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
					var vDiff = arrayModel[i].Sets[vSet].Difficulty;

					var vAllowCase = 100 - parseInt(arrayDifficulty[vDiff].AllowChance,10);
					var vRuinCase = vAllowCase - parseInt(arrayDifficulty[vDiff].RuinChance,10);

				    var rand = guide.getRandom("(1..100)");
					var roll = rand + vModifier;
					
					
				  switch (true)
					{
					 case roll > vAllowCase:
						overRide.addButton("Allow", "Please...", "", "", "", "", "");
						break;
					 case roll > vRuinCase:
						overRide.addButton("Ruin", "Please...", "", "", "", "", "");
						break;
					default:
						overRide.addButton("No", "Please...", "", "", "", "", "");
					}

				    overRide.setHtml("Ask nicely" + "  " + rand + "-" + vModifier + "-" + roll);
				    overRide.image = vPath + "/Ask/*.jpg";

				}

			]]>
		</javascript>
    </Page>
	
	<Page id="Allow">
      <Text>Seeing this means something went wrong on the page - Allow</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;

					var vResponse = arrayModel[i].Name + ": " + arrayAllow[Math.floor(Math.random()*arrayAllow.length)];

			  overRide.setHtml(vResponse + " - " + vModifier);
			  overRide.image = vPath + "/Yes/*.jpg";

				}

			]]>
		</javascript>
	  <Button target="start">Someone else?</Button>
	  <Button target="Retry">Try Again?</Button>
    </Page>	

	<Page id="Ruin">
      <Text>Seeing this means something went wrong on the page - Ruin</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;

					var vResponse = arrayModel[i].Name + ": " + arrayRuin[Math.floor(Math.random()*arrayRuin.length)];

			  overRide.setHtml(vResponse + " - " + vModifier);
			  overRide.image = vPath + "/No/*.jpg";

				}

			]]>
		</javascript>
	  <Button target="start">Someone else?</Button>
	  <Button target="Retry">Try Again?</Button>
    </Page>	
	
	<Page id="No">
      <Text>Seeing this means something went wrong on the page - No</Text>
		<javascript>
			<![CDATA[
				function pageLoad() {
					var i = parseInt(scriptVars.get("vSelected"),10);
					var vSet = parseInt(scriptVars.get("vSet"),10);
					var vPath = arrayModel[i].Sets[vSet].Path;
										
					var vResponse = arrayModel[i].Name + ": " + arrayDeny[Math.floor(Math.random()*arrayDeny.length)];

			  overRide.setHtml(vResponse + " - " + vModifier);
			  overRide.image = vPath + "/No/*.jpg";

				}

			]]>
		</javascript>
      <Button target="start">Someone else?</Button>
	  <Button target="Retry">Try Again?</Button>
	</Page>	
	
  </Pages>
</Tease>
To elaborate a bit on RemiHiyama's answer, basically you can't use globals like that in GuideMe.
You would initialize the value of vModifier in your start page with

Code: Select all

scriptsVars.put("vModifier",3);
initializing it to 3 for example. This will happen every time the tease is loaded, assuming ForceStartPage is true.

Then in your other pages (like page "AsK" for example) you use it like

Code: Select all

var roll = rand + scriptVars.get("vModifier");
If GuideMe is returning vModifier as a string, only then would you need to wrap it in parseInt like

Code: Select all

var roll = rand + parseInt(scriptVars.get("vModifier"));
In your sample code you do not change the value of vModifier anywhere, but if/when you do you need to update the scriptvar using scriptVars.put() again.

If you don't want vModifier to reset on every load you can initialize it in your start page like this

Code: Select all

var vModifier = scriptVars.get("vModifier") || 3; // Retrieve value from last run, or initialize to 3
scriptsVars.put("vModifier",vModifier); // Save current value
Then it will only reset if you do a File/Restart in Guideme.

Hope that helps.

PG
Post Reply