[Proof of concept][v0.0.6 (4.6.2019)][GuideMe] Ravelli's Revange

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

User avatar
Pseudonym
Explorer At Heart
Explorer At Heart
Posts: 331
Joined: Sat Sep 22, 2012 12:03 pm

Re: [Proof of concept][v0.0.6 (4.6.2019)][GuideMe] Ravelli's Revange

Post by Pseudonym »

desertfox wrote: Wed Jun 12, 2019 1:44 am I'm a little rusty on the guideme/javascript but does a page normally look for a script var and expand it by just having it's name? I thought you had to use an override.html() function to change what text comes out during the java script. I haven't kept up on guideme changes though for a while. Hopefully someone who knows better can correct me if I'm wrong with anything.
Spans work too, but you are right, if you want do some specific things you need override.html().
Atleast that's my understanding.
desertfox wrote: Wed Jun 12, 2019 1:44 am Another thing to think of is something called scope. (Sorry if going too basic not sure where you are at with programming concepts) Scope means essentially 'where do my variables live and for how long'. In your examplle, the 'var vTestAd' lives only as long as the pageLoad function, then it is gone. When you put it into the scriptVars though, it now lives as long as guideme lives in the scriptvars container.
You would put things into the scriptVars if you needed the information at a later time in the tease, which you could get with a get call. So whenever you put something into the script vars is just long term storage that you'll need on another page. If you are doing work for just that page you don't have to add it to scriptVars.


So it's important to know that they are two different things.

Code: Select all

var vTestAd = "Why this doesnt???";  // local scope, gone as soon as pageload is done
scriptVars.put("vTestAd", vTestAd);  //you made a variable called vTestAd that contains the value if your local var ("Why this doesnt???"). 
Yes, I'm trying to not use global variables if I don't need to, but to show variable in span it needs to be global. Atleast I think based on my experience.

desertfox wrote: Wed Jun 12, 2019 1:44 am So all in all I would write it something like this (based on what I learned when doing maze tease, also didn't test this).

Code: Select all

<Page id="StringsTesting">
 <javascript>
   <![CDATA[
   function pageLoad() {

   //These might be a scriptVars.get of an array of random words instead
    var vTestAd = "Why this doesnt???";
    var vTestA = "Why this works???";

    var vRandomStringX = "Lala" +vTestAd +"lala.";
    var vRandomStringY = "Lala" +vTestA +lala.";
    
    //html will just be a string of what will be written out on the page
    var html = "<p class=\"Text\"><span>" +vRandomStringX +"</span></p>"
	  	  +"<p class=\"Text\"><span>" +vRandomStringY +"</span></p>"

   //Here you tell guideme to change the page text area to the string we built
    overRide.setHtml( html);
   }
   ]]>
 </javascript>
 </Page>
Yes, the crucial part here is not to use spans inside spans. When you try to do it GuideMe will start to behave very strangely and inconsistantly.
desertfox wrote: Wed Jun 12, 2019 1:44 am Hopefully that makes some sense how I've structured it. Again any of the javascript / guideme wizes here please correct me on anything I've said wrong.
No, this was very helpful. I've finally solved my problem and made this keyword substitution work properly.
My problem was:
1) Using spans in spans
2) Not understanding how to properly initialize and later change variables/keywords in my text arrays


Now it finally works and I like the result! It's not magic but it's one more step towards more variety.
The next logical step to improve quality of the text is creating personality modules and using more and more and more context. That's seems like a more long term problem and I'll work on it as I expand my tease.

Thanks Desertfox!
My Discord server: https://discord.gg/tbQxJ22
My latest release: Cock Hero - Replay viewtopic.php?t=24640
All my work so far: https://mega.nz/folder/sdcHmQzT#PZ4ctIZsoGp4N7zuDmIh_Q
Post Reply

Who is online

Users browsing this forum: Android71, MrJendra and 14 guests