GuideMe Scripting Engine

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

desertfox
Explorer At Heart
Explorer At Heart
Posts: 365
Joined: Mon Dec 03, 2012 7:26 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: GuideMe Scripting Engine

Post by desertfox »

Hello, I had another question about using the script engine with variables. I'm wondering if I am misusing it in some places and in others how to go about doing them.

Well question 1 is first, can I get variables that are in script vars, and can I test them in an if statement at all? For example, I'm trying to track the number of edges a player does, right now I just have it increment a counter then do stuff with that value out in the guideme area of things. I was wondering if there was some way that I could read it in the script engine and compare, a basic if statement or a goto, sort of like ifSet theFlag goto thePlace.

The more specific question is, is I want to do a tease that is random, so I want it to pick a random number of edges to do, then track on that. Do I have any way of checking variable values? I kind of started with this:
edges_max = <Random 6,12>

then didn't quite know what I could do with that number. I guess I could make say 12 goSub style flags and jump to the appropriate one, like

Code: Select all

edges1:
", First edge
return

edges2:
", first edge
", second edge
return

edges3:
", first edge
", second edge
", third edge
return
Is there a way I could just say something like

if playerEdges == max_edges goto AllDone

?

No big deal again, just want to make sure I'm not artificially limiting myself in how i'm tackling things.
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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 Scripting Engine

Post by PlayfulGuy »

desertfox wrote:Might have found an issue, though could be doing something wrong. It does come back to the page but it seems to not have saved the audio or buttons when it comes back. On the page I was testing it just had local buttons and an audio above the page definition.

<snip>

I wouldn't kill yourself on this either or stop your momentum too much on your other project if it's getting in the way, people shouldn't leave in the middle of a script anyhow ;)
Okay, so I finally got around to looking at this. What I did to allow the script to reload is save the index of the page command. This leaves out the button and audio commands leading up to the page definition. So a sequence like

Code: Select all

Button Continue
Audio SaySomething.wav
myImage.jpg, "Do as you're told slave!"
would end up reloading with no button and no audio.

The "quick and easy" fix for you is to use the block form for the page like

Code: Select all

myImage.jpg {
	button Continue
	Audio SaySomething.wav
	Do as you're told slave!
}
This will reload properly.

I can make a very simple adjustment to the script engine code to compensate for this, but naturally there's a downside. All commands from one page to the next would get executed on a reload, so in a sequence like

Code: Select all

myImage1.jpg "Edge for me slave"
edges = edges + 1
Button Continue
myImage.jpg "now rest a moment."

If the "rest a moment" page was reloaded the increment of "edges" would happen again which would not be correct.

The getNextPage() function that's called to load the next page resets the audio and button components to prepare for the next page (basically assuming it's loading a page from scratch). To completely fix this without breaking something else I need to code in some checks to determine whether or not the page is displaying for the first time, or is reloading. Totally doable, but will take some thinking.

I think it's worth doing so I will work on that and post an update, but in the meantime you can use the block format workaround noted above.

PG
desertfox
Explorer At Heart
Explorer At Heart
Posts: 365
Joined: Mon Dec 03, 2012 7:26 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: GuideMe Scripting Engine

Post by desertfox »

Ohhh, nice. I didn't even realize I could do the audio and buttons inline like that. For some reason I thought inline buttons meant it would show up on the upper text portion of the sidebar. Now that I have a lot more text in them I wish I had done that from the start since it keeps everything a little more associated together than doing it above the page definition.

Thank you, I'll be doing everything that way from now on.

*Edit* I thought i would post these as well, made a few sublime text snippets to speed up typing, nothing really fancy here, but saves some time if anybody uses that editor. To put them in just go to tools...new snippet and make a file for each one called whatever.sublime-snippet.

They work by you basically typing the <tabTrigger> text and pressing tab. It'll replace that trigger with the stuff above. Anywhere the $1 $2 etc is above is a tab target too.
Spoiler: show

Code: Select all

<snippet>
	<content><![CDATA[
${1:"}, ${2:12}, ${3:60}, { $4
}
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>sp</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<!-- <scope>source.python</scope> -->
</snippet>
This one is a 'stroke page' (sp) so basically you hit tab here and you get this typed in

Code: Select all

",12,60 {
}
Then you can tab to change the ", tab to change the delay(12) and tab to type the metronome, then tab into the page body. Saves a little bit of time.

This one is just a 'text page' so a picture and text.
Spoiler: show

Code: Select all

<snippet>
	<content><![CDATA[
${1:"}, { $2
}
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>tp</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<!-- <scope>source.python</scope> -->
</snippet>
And finally here is one for regular guideme pages with javascript on top:
Spoiler: show

Code: Select all

<snippet>
	<content><![CDATA[
<Page id="$1">		
	<javascript>
	![CDATA[$NOT_DEFINED
	function pageLoad() 
	{
		$2
	}
	]]$NOT_DEFINED>
	</javascript>
	<Text></Text>
</Page>
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>page</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<!-- <scope>source.python</scope> -->
</snippet>
Pylon
Explorer
Explorer
Posts: 19
Joined: Wed Jan 27, 2016 4:47 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: GuideMe Scripting Engine

Post by Pylon »

When I click on the link it says it's been removed. Where can I download this? I've tried other links throughout this thread and none of them work.
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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 Scripting Engine

Post by PlayfulGuy »

Pylon wrote:When I click on the link it says it's been removed. Where can I download this? I've tried other links throughout this thread and none of them work.
I tested the two links in the first post of this thread and the first was broken but the second (a paragraph or two down) worked for me.

I have just updated the first post of this thread with new links to the latest files that include some bug fixes.

PG
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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 Scripting Engine

Post by PlayfulGuy »

I have just uploaded a new version of the script engine (1.3) and have updated the links in the first post of this thread. This version corrects some issues with resuming a script when closing and reopening Guideme.

It turns out that what I did in version 1.2 was mostly unnecessary. There was a much simpler way to achieve the desired result. Once it dawned on me, I actually went back to the version 1.1 code and used the much simpler method of supporting a reloaded script and then incorporated the other bug fixes I'd added in 1.2.

Have fun!

PG
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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 Scripting Engine

Post by PlayfulGuy »

I just realized that I never responded to this. See replies inserted below.
desertfox wrote:Hello, I had another question about using the script engine with variables. I'm wondering if I am misusing it in some places and in others how to go about doing them.

Well question 1 is first, can I get variables that are in script vars, and can I test them in an if statement at all? For example, I'm trying to track the number of edges a player does, right now I just have it increment a counter then do stuff with that value out in the guideme area of things. I was wondering if there was some way that I could read it in the script engine and compare, a basic if statement or a goto, sort of like ifSet theFlag goto thePlace.
At this point no. There is no support for if statements or testing of variables. I do plan to add it in certain places. Let me know any examples of where you would like to be able to use it so I can make sure I include those.
desertfox wrote: The more specific question is, is I want to do a tease that is random, so I want it to pick a random number of edges to do, then track on that. Do I have any way of checking variable values? I kind of started with this:
edges_max = <Random 6,12>

then didn't quite know what I could do with that number. I guess I could make say 12 goSub style flags and jump to the appropriate one, like
Spoiler: show

Code: Select all

edges1:
", First edge
return

edges2:
", first edge
", second edge
return

edges3:
", first edge
", second edge
", third edge
return
Is there a way I could just say something like

if playerEdges == max_edges goto AllDone

?

No big deal again, just want to make sure I'm not artificially limiting myself in how i'm tackling things.
What I would do with that is write a guideme page or two that references the variable(s) and loops through the set of edges. Say something like

Code: Select all

DoEdges = <random 6,12>
goto DoTheEdges	// DoTheEdges is a guideme page that loops to do the number of edges specified in variable DoEdges

For a purely scripted version you could do something like

Code: Select all

goto DoEdges<Random 6,12>

DoEdges12:
", Edge

DoEdges11:
",  edge

DoEdges10:
",  edge

<etc>

DoEdges2:
", edge

DoEdges1:
", edge
return
This picks a random number from 6 to 12 and branches to label DoEdges<number>. The script then flows down to the last edge which you can end wherever you want. Using this structure you could support any range you want, but it's clunky.

I could even write that page and add it to the script engine. It's a nice general purpose kind of thing. Another feature that is already sketched in to the engine is automatic counting of edges. It recognizes buttons labelled "Edged", "Edging", "I Edged" and could automatically count the edges. I just hadn't added a way to access the value yet, so your request (as usual) fits my long term plans anyway. Great minds I guess :-)

PG
desertfox
Explorer At Heart
Explorer At Heart
Posts: 365
Joined: Mon Dec 03, 2012 7:26 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: GuideMe Scripting Engine

Post by desertfox »

Yes, get out of my damn head already! :)

I don't know why I didn't think to do the pages like that in reverse order. I was planning on basically setting it up like that but was like, ohh how do i know to stop at 7 edges. But going backwards *forehead smack*.

That edge counter would be pretty damn useful. I am trying to track edges and I just have to remember to add a counter right on the landing page of an Edged button, but I forget to do it sometimes. If it was tackling that automatically that would be pretty awesome.

For if statements, I THINK the only place I am practically wanting them is to compare integers, like the edge count, so if they are say over a certain amount you can goto another page.

Oh now that I think about it, it would be nice to be able to tap into the guideme feature of being able to do something if some flags are set AND if some are UNset. Very easy to work around this though.

Also while laying the feature smackdown here if at the least could add a loop parameter for audio. I don't think the other ones would be something you would use in a script tease so probably isn't necessary to map it as completely as you did the video one.

Well anyway, should be able to try out the new version a bit later tonight, thank you for doing the update!
philo
Explorer At Heart
Explorer At Heart
Posts: 831
Joined: Sun Jan 08, 2012 3:10 pm
Gender: Male
Sexual Orientation: Straight
Location: UK

Re: GuideMe Scripting Engine

Post by philo »

desertfox wrote:Oh now that I think about it, it would be nice to be able to tap into the guideme feature of being able to do something if some flags are set AND if some are UNset. Very easy to work around this though.
Hopefully that should be fairly easy, GuideMe exposes the same functions it uses internally
They are in guide
canShow
setFlags
unsetFlags
isSet
isNotSet
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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 Scripting Engine

Post by PlayfulGuy »

philo wrote:
desertfox wrote:Oh now that I think about it, it would be nice to be able to tap into the guideme feature of being able to do something if some flags are set AND if some are UNset. Very easy to work around this though.
Hopefully that should be fairly easy, GuideMe exposes the same functions it uses internally
They are in guide
canShow
setFlags
unsetFlags
isSet
isNotSet
The script engine actually uses these Guideme functions to test the specified flags, but it does not allow you to easily combine set and unset in one command. You can do something like

Code: Select all

ifSet FlagA goto Skip
ifNotSet FlagB goto Skip
  Stuff here is executed ifNotSet(FlagA) And ifSet(FlagB)
  .
  .
  goto Continue
Skip:
 Stuff here is excuted ifSet(FlagA) Or ifNotSet(FlagB)

Continue
You have to think it through and flip the logic, but it works.

Since that's hard to maintain and hard to understand, I'm thinking about adding a generic if command that would allow more general testing of variables and conditions.
desertfox wrote:Yes, get out of my damn head already! :)
LOL
desertfox wrote: That edge counter would be pretty damn useful. I am trying to track edges and I just have to remember to add a counter right on the landing page of an Edged button, but I forget to do it sometimes. If it was tackling that automatically that would be pretty awesome.

For if statements, I THINK the only place I am practically wanting them is to compare integers, like the edge count, so if they are say over a certain amount you can goto another page.

Oh now that I think about it, it would be nice to be able to tap into the guideme feature of being able to do something if some flags are set AND if some are UNset. Very easy to work around this though.

Also while laying the feature smackdown here if at the least could add a loop parameter for audio. I don't think the other ones would be something you would use in a script tease so probably isn't necessary to map it as completely as you did the video one.
Auto edge counter. Easy.
Loop parameter on Audio. Peasy.
if statements to combine set and unset tests. I'll start work on that. It's really not that hard, and will probably be even more powerful than you expect.

Cheers!

PG
desertfox
Explorer At Heart
Explorer At Heart
Posts: 365
Joined: Mon Dec 03, 2012 7:26 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: GuideMe Scripting Engine

Post by desertfox »

You guys rock.

That is all.
philo
Explorer At Heart
Explorer At Heart
Posts: 831
Joined: Sun Jan 08, 2012 3:10 pm
Gender: Male
Sexual Orientation: Straight
Location: UK

Re: GuideMe Scripting Engine

Post by philo »

If you need better functions for handling flags I am open to suggestions to add them to guide.
anything that makes it easier for script writters will enhance guideme

oh and have you looked at canShow, it takes two lists of flags, does ifset on one and ifnotset on the other and returns true if both ifset and ifnotset returned true
desertfox
Explorer At Heart
Explorer At Heart
Posts: 365
Joined: Mon Dec 03, 2012 7:26 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: GuideMe Scripting Engine

Post by desertfox »

philo wrote:If you need better functions for handling flags I am open to suggestions to add them to guide.
anything that makes it easier for script writters will enhance guideme

oh and have you looked at canShow, it takes two lists of flags, does ifset on one and ifnotset on the other and returns true if both ifset and ifnotset returned true
I think what you have in there with flags between them all covers everything Philo! I was asking before about using it in the scriptengine, which doesn't have the combinations mapped 1 to 1 to everything in guideme.

I did a few pages that were sort of similar to how the script engine works and really it just felt like there was a Guide, override, or button parameter for anything I can think of, plus having javascript and the scriptVars available and there is really just no hold up for anything.

I like the script engine just for the brevity in making pages, it is really simple to keep doing "image.jpg,12,60, m Stroke!" and have a page, and branching is slightly easier to track just in the format for myself too, and the last stuff added to be able to drop to guideme pages for more complex then come back works out really well too.

They are both a really complementary pair to do teases in.
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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

You're gonna love this!

Post by PlayfulGuy »

I have finished the coding and just need to do final testing and write some tutorial scripts, but here's what's coming, very soon.

Automatic edge counting. Any button labelled "Edge", "Edged", "I Edged", "Edging", "On the edge" and other variations will trigger an automatic increment of the counter which is stored in variable EdgeCount. The engine also sets the flag UserEdged so you can do something like

Code: Select all

ifSet UserEdged goto badBoy
The same is true for any button like "Came", "I Came", "Ruined", "I Ruined", "I Came Mistress", etc. The engine sets the flags UserCame or UserRuined as appropriate so you can easily test for those conditions. It doesn't count them but if you think that would be useful I'll add it.

A general purpose if command of the form

Code: Select all

if ( expression ) command
with full expression support and two special functions isSet() and isNotSet() so you can do things like

Code: Select all

if ( count >= 5) goto EnoughCounting

if ( count < 5 ) count = count + 1

if ( isSet(FlagA) and isNotSet(FlagB) ) goto Condition1

if ( isSet(FlagA+FlagB) ) goto Condition2

if ( count > 5 and isNotSet(UserCame) ) image1.jpg, You are the best!

The testing of flags uses the canShow() function provided by GuideMe so whatever syntax GuideMe supports can be used in a script. It supports both And and Or conditions and uses standard javascript syntax for so you can have elaborate expressions like

Code: Select all

if ( ( isSet(FlagA) and isNotSet(FlagB) ) Or (isSet(FlagA) and count > 7) ) set UserIsAMachine
As with the existing ifSet and ifNotSet commands the command portion can be any valid script command.

While I was at it I added the ability to display any variable in the text of a page using the short form tag <variableName>. So if you wanted to show the current edge count you could do

Code: Select all

image27.jpg, So far you've edged <EdgeCount> times.
or 
if ( EdgeCount == 5) Image27.jpg, You're up to <EdgeCount> edges now.
The possibilities are endless!

I'm thrilled I've got this all working. If I could find a way to get paid for this I'd think I'd died and gone to heaven.

I should be able to get this finalized and posted by the end of the week, next weekend at the latest.

Bye for now

PG
User avatar
PlayfulGuy
Explorer At Heart
Explorer At Heart
Posts: 778
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 Scripting Engine

Post by PlayfulGuy »

philo wrote:If you need better functions for handling flags I am open to suggestions to add them to guide.
anything that makes it easier for script writters will enhance guideme
Thanks for the offer. I think you have it covered so far, but if I think of anything you'll be the first to know.
philo wrote: oh and have you looked at canShow, it takes two lists of flags, does ifset on one and ifnotset on the other and returns true if both ifset and ifnotset returned true
That's exactly what I use. Pretty much all I do in the script engine is expose what GuideMe already provides in a different way.

PG
Post Reply

Who is online

Users browsing this forum: Spielers and 18 guests