summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/toy.groovy100
-rw-r--r--scripts/toy/social.groovy88
2 files changed, 103 insertions, 85 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 1dfadca..d7747a7 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -34,8 +34,6 @@ return new Object() {
final RELEASEFROM = "releaseFrom";
final LUNCH = "lunch", SHOPPING = "shopping", PARTY = "party", SLEEPING = "sleeping";
final BEDTIME = "bedtime", WAKEUP = "wakeup", BEDTIMECHECK = "bedtimeCheck";
- final BEGINPLAN = "beginPlan", ENDPLAN = "endPlan";
- final FRIENDS = [ "Tori", "Sophie", "Krystal" ];
// toy.position
final KNEELING = "kneeling", ALLFOURS = "allfours", STANDING = "standing";
def OWNER = null;
@@ -1792,85 +1790,19 @@ return new Object() {
};
// Setup
- // Plans - cannot overlap
- def setupPlan = { plan, float startmin, float startmax, float endmin, float endmax ->
- def timeWindow = { float min, float max -> (int)((min * HOUR) - localTimeOffset() + getRandom((int)((max - min) * HOUR))) };
- final friendName = FRIENDS[getRandom(FRIENDS.size())];
- def day = getDay() + ((getRandom(3) + 1) * DAY);
- addEventIfMissing(plan, day + timeWindow(startmin, startmax), BEGINPLAN,
- [friendName: friendName, returnTime: day + timeWindow(endmin, endmax)]);
- }
- def setupPlans = {
- save("toy.plan", null);
- setupPlan(LUNCH, 11.5, 12.5, 13.0, 14.0)
- setupPlan(SHOPPING, 14.5, 15.5, 16.0, 18.0)
- setupPlan(PARTY, 19, 20, 22.0, 25.0)
- };
def setupEvents = {
playSchedule();
sleepSchedule();
- setupPlans();
};
def setDefault = { prop, val ->
if (loadString(prop) == null) {
save(prop, val);
}
};
- def leaveNote = { msg, instr ->
- save("toy.note", msg);
- save("toy.noteInstr", instr);
- };
- def readNote = {
- leaveNote(null, null);
- };
- def plannedCheck = { plan ->
- return (getTime() > loadInteger("toy.plan.${plan}.${START}") && getTime() < loadInteger("toy.plan.${plan}.${END}"));
- }
- def beginPlan = { rt, plan, args ->
- addEvent(plan, args.returnTime, ENDPLAN, args.friendName);
- dress([[DRESSED,nTEASE], [DRESSED,TEASE]]);
- if (rt && sessionSummon([DRESSED,nTEASE])) {
- present([DRESSED,nTEASE], [
- [ "I'm going out now, toy.", "$plan time!" ],
- [ "Will you be good while I'm gone?", "You will behave as I expect?" ]]);
- wait(10);
- postChastity();
- def toys = TOYTOYS.findAll { t -> stateIs(t) };
- Collections.shuffle(toys);
- toys.each { removeToy(it, [DRESSED,nTEASE]) };
- removeEvent(REDRESS);
- set(NAKED, false);
- present([DRESSED,TEASE], [
- [ "Back later!", "See you soon, toy" ]]);
- wait(5);
- }
- else if (has(CHASTITY) && !stateIs(CHASTE)) {
- leaveNote("I want you in chastity until I return!", CHASTE);
- }
- DOMME = loadDomme(OWNER);
- setAway(plan);
- removeEvent(PLAY);
- showLounge();
- };
- def endPlan = { rt, plan ->
- save("toy.owner.outfitTime", getTime());
- setAway(null);
- if (rt && sessionSummon([DRESSED])) {
- present([DRESSED], [["Hello, toy!"], ["I'm back home now."]]);
- wait(10);
- showLounge();
- }
- readNote();
- playSchedule();
- setupPlans();
- };
- // Initial - basic checks and defaults
def namedEvents = [
bedtime: { name, arg, schedTime, rt -> bedtime(rt, schedTime) },
bedtimeCheck: { name, arg, schedTime, rt -> bedtimeCheck(rt) },
wakeup: { name, arg, schedTime, rt -> wakeup(rt) },
- beginPlan: { name, arg, schedTime, rt -> beginPlan(rt, name, arg) },
- endPlan: { name, arg, schedTime, rt -> endPlan(rt, name) },
play: { name, arg, schedTime, rt -> playEvent(rt, arg) },
releaseFrom: { name, arg, schedTime, rt -> releaseFrom(rt, arg, name) },
redress: { name, arg, schedTime, rt -> redress(rt) },
@@ -1952,18 +1884,19 @@ return new Object() {
def showFaq = {
useUrl("http://toy.randomdan.homeip.net/");
};
- def setupShowCalendar = {
- final events = loadEvents();
- show(
- [LUNCH, SHOPPING, PARTY].collect {
- final event = events[it];
- if (!event) return "";
- def s = event.time;
- def f = event.arg.friendName;
- def timeStr = localTimeOf(s).format(soonFormatter);
- return "$it with $f on $timeStr.\n".capitalize();
- }.join());
- showButton("OK");
+
+ final addNamedEvent = { String name, func ->
+ namedEvents[name] = func;
+ }
+ def requestables = [
+ faq: [ lbl: "FAQ (webpage)", act: showFaq ],
+ confess: [ lbl: "Confess", act: confess ],
+ ];
+ final addRequestable = { String name, String label, func ->
+ requestables[name] = [lbl: label, act: func];
+ };
+ final removeRequestable = { String name ->
+ requestables.remove(name);
};
String main()
@@ -2030,11 +1963,7 @@ return new Object() {
final waitTime = Math.min(cycleTime, e.event.time - getTime());
final clickTime = showButton("Please, ${dommeTitle()}?", waitTime);
if (clickTime < waitTime) {
- def opts = [
- [ lbl: "FAQ (webpage)", act: showFaq ],
- [ lbl: "Calendar", act: setupShowCalendar ],
- [ lbl: "Confess", act: confess ],
- ];
+ def opts = requestables.values().toList();
if (stateIs("DEBUG")) {
opts.push([ lbl: "Status", act: setupShowState ]);
opts.push([ lbl: "Play", act: playEvent, arg: true ]);
@@ -2067,6 +1996,7 @@ return new Object() {
/*
* Resources
* scripts/toy.groovy
+ * scripts/toy/social.groovy
* images/toy/ancilla/corset/1.jpg
* images/toy/ancilla/corset/10.jpg
* images/toy/ancilla/corset/11.jpg
diff --git a/scripts/toy/social.groovy b/scripts/toy/social.groovy
new file mode 100644
index 0000000..9617b65
--- /dev/null
+++ b/scripts/toy/social.groovy
@@ -0,0 +1,88 @@
+{ toy ->
+ final LUNCH = "lunch", SHOPPING = "shopping", PARTY = "party";
+ final BEGINPLAN = "beginPlan", ENDPLAN = "endPlan";
+ final FRIENDS = [ "Tori", "Sophie", "Krystal" ];
+
+ toy.metaClass.setupPlan { plan, float startmin, float startmax, float endmin, float endmax ->
+ final timeWindow = { float min, float max -> (int)((min * HOUR) - localTimeOffset() + getRandom((int)((max - min) * HOUR))) };
+ final friendName = FRIENDS[getRandom(FRIENDS.size())];
+ final day = getDay() + ((getRandom(3) + 1) * DAY);
+ addEventIfMissing(plan, day + timeWindow(startmin, startmax), BEGINPLAN,
+ [friendName: friendName, returnTime: day + timeWindow(endmin, endmax)]);
+ }
+
+ toy.metaClass.setupPlans {
+ save("toy.plan", null);
+ setupPlan(LUNCH, 11.5, 12.5, 13.0, 14.0)
+ setupPlan(SHOPPING, 14.5, 15.5, 16.0, 18.0)
+ setupPlan(PARTY, 19, 20, 22.0, 25.0)
+ };
+
+ toy.metaClass.leaveNote { msg, instr ->
+ save("toy.note", msg);
+ save("toy.noteInstr", instr);
+ };
+
+ toy.metaClass.readNote {
+ leaveNote(null, null);
+ };
+
+ toy.metaClass.beginPlan { rt, plan, args ->
+ addEvent(plan, args.returnTime, ENDPLAN, args.friendName);
+ dress([[DRESSED,nTEASE], [DRESSED,TEASE]]);
+ if (rt && sessionSummon([DRESSED,nTEASE])) {
+ present([DRESSED,nTEASE], [
+ [ "I'm going out now, toy.", "$plan time!" ],
+ [ "Will you be good while I'm gone?", "You will behave as I expect?" ]]);
+ wait(10);
+ postChastity();
+ def toys = TOYTOYS.findAll { t -> stateIs(t) };
+ Collections.shuffle(toys);
+ toys.each { removeToy(it, [DRESSED,nTEASE]) };
+ removeEvent(REDRESS);
+ set(NAKED, false);
+ present([DRESSED,TEASE], [
+ [ "Back later!", "See you soon, toy" ]]);
+ wait(5);
+ }
+ else if (has(CHASTITY) && !stateIs(CHASTE)) {
+ leaveNote("I want you in chastity until I return!", CHASTE);
+ }
+ DOMME = loadDomme(OWNER);
+ setAway(plan);
+ removeEvent(PLAY);
+ showLounge();
+ };
+
+ toy.metaClass.endPlan { rt ->
+ save("toy.owner.outfitTime", getTime());
+ setAway(null);
+ if (rt && sessionSummon([DRESSED])) {
+ present([DRESSED], [["Hello, toy!"], ["I'm back home now."]]);
+ wait(10);
+ showLounge();
+ }
+ readNote();
+ playSchedule();
+ setupPlans();
+ };
+
+ toy.metaClass.showCalendar {
+ final events = loadEvents();
+ show(
+ [LUNCH, SHOPPING, PARTY].collect {
+ final event = events[it];
+ if (!event) return "";
+ def s = event.time;
+ def f = event.arg.friendName;
+ def timeStr = localTimeOf(s).format(soonFormatter);
+ return "$it with $f on $timeStr.\n".capitalize();
+ }.join());
+ showButton("OK");
+ };
+
+ toy.addNamedEvent(BEGINPLAN, { name, arg, schedTime, rt -> toy.beginPlan(rt, name, arg) });
+ toy.addNamedEvent(ENDPLAN, { name, arg, schedTime, rt -> toy.endPlan(rt) });
+ toy.addRequestable("calendar", "Calendar", { toy.showCalendar() });
+ toy.setupPlans();
+}