[EOS/TOOL] EOS Magpie - Eos Script Merging Tool

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

[EOS/TOOL] EOS Magpie - Eos Script Merging Tool

Post by fapnip »

Here's my "Eos Magpie" tool for merging data from one Eos script to another:
https://codepen.io/fapnip/full/GRjwPXP

It's called Eos Magpie, because like a common myth surrounding the magpie, it lets you grab shiny things from Eos tease scripts.

Use it to copy data (pages, images, etc.) from one Eos script source, merge it with another, and download the merged JSON.

Let me know if you find it useful, or have issues. Built for my own use, but figured some of you may find it helpful.

(Updated to make it easier to recover images missing in target from a source that has one or more of the given images.)

Here's some things you can embed in your tease's Init Script to tell Eos Magpie what to do:

Name / Version of tease
So Magpie can know what your tease's name and version is, simply add the following to the start of your Init Script

Code: Select all

/************************
 * My Tease Name v1.2.3
 */
Display notice to users of Eos Magpie
To display a message to users of Eos Magpie that have entered your tease as the "source", add the following anywhere in your Init Script

Code: Select all

/*--magpie-warn
Please be nice and let me know if you're using my tease.
Thanks.
*/
Automatic updates
To tell Magpie to automatically select the init script and source pages that are different or missing in the target if the tease name for the source and target are the same, or if the target has an empty init script, add the following anywhere in your Init Script:
(If the page already exists in target, it WILL be marked for replacement.)

Code: Select all

/*--auto-magpie-core
my-page-that-should-be-updated
and-so-on
pages-names-*
*/
To tell Magpie to automatically select source pages that are missing in the target if the tease name for the source and target are the same, add the following anywhere in your Init Script:
(If the page already exists in target, it will NOT be marked for replacement.)

Code: Select all

/*--auto-magpie-require
my-page-that-is-needed
another-required-page
*/
Keeping an action from target when replacing page from source
To tell Magpie to keep changes in a specific action when updating a page, place an eval containing the --auto-magpie-merge:[unique-merge-id] tag right before the given action. (Note: Replace "[unique-merge-id]" with a unique (relative to page) string. This allows magpie to know which actions to merge in target and source.):

Code: Select all

/*--auto-magpie-merge:my-merge-id-1121 */
Now, the action immediately following the auto-magpie-merge eval tag in the target will not be overwritten with the same action from the source. Eval tag must exist in both source and target, and tag ids (the string following the ":") must be unique, relative to page. If not, you'll end up with a mess after merge.

Creating a "Magpie Module"
A Magpie Module is a group of actions and evals that can be shared with other tease authors, and allows them to easily install and update the module in their own teases using Magpie.

To create a module, add an IF action to you start page. In that if action, set the condition to something like:

Code: Select all

!window.MyMagpieModule /* MPEM::MyMagpieModule v1.0.0 */
Where "MyMagpieModule" is the unique name of your magpie module. (Make sure you're not conflicting with another Magpie module, or an existing JavaScript object.)

In the IF's actions, you must have, at a minimum, an Eval action that creates your Module's object/prototype. For example:

Code: Select all

// We always want to wrap in an immediate function to avoid global namespace pollution.
;(function(){
  // First some optional header information so Magpie can display things to users
  /***************************
  * MyMagpieModule
  ****************************
  MPED--author::My Milovana User Name
  MPED--description::
A description of an otherwise useless example Magpie Module, displayed in Magpie

See:
https://milovana.com/forum/posting.php?mode=edit&f=4&p=294482
  ::--description
  */

  // Now the real code for the Module
  if (window.MyMagpieModule) return // already installed.  Get out.
  // Define a constructor method for our module prototype
  funciton MyMagpieModule(opts) {
    // If we didn't get any options, make some default ones
    opts = opts || {
      name: 'Billy the Bob',
      level: 0,
    }
    this.name = opts.name
    this.level = opts.level || 0
  }
  
  // Create some methods
  MyMagpieModule.prototype.getName = function () {
    return this.name
  }
  MyMagpieModule.prototype.getLevel = function () {
    return this.level
  }
  MyMagpieModule.prototype.incrementLevel = function () {
    this.level++
  }
  
  // Export our module to the world
  window.MyMagpieModule = MyMagpieModule
  
})()
Now, after this useless example module has been loaded in the start page, it can be used like:

Code: Select all

// This module example uses a prototype, so we need to create an instance of it to use it.
if (!window.myUselessModuleInstance) {
  // We don't have a global instance built yet, so let's do that.
  window.myUselessModuleInstance = new MyMagpieModule({
    name: 'Super Fly',
    level: 2,
  })
}

// Now that we have an instance created, we can use it
console.log("Here's some useless information:", myUselessModuleInstance.getName(), myUselessModuleInstance.getLevel())
For an example of a real Magie Module that does something useful, see:
viewtopic.php?f=2&t=24275
Last edited by fapnip on Mon Nov 29, 2021 5:07 pm, edited 13 times in total.
Roblsforbobls
Explorer At Heart
Explorer At Heart
Posts: 260
Joined: Tue May 21, 2019 2:27 am
Gender: Male
Sexual Orientation: Asexual
I am a: Switch

Re: EOS Magpie - Eos Script Merging Tool

Post by Roblsforbobls »

Ok, now THAT is a good idea! Thanks for sharing :yes:
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS Magpie - Eos Script Merging Tool

Post by fapnip »

Roblsforbobls wrote: Wed Jan 20, 2021 7:00 am Ok, now THAT is a good idea!
So all my other ideas are just chopped liver, eh? ;-)

(Eos Magpie has been updated with a few bug fixes/features.)
Roblsforbobls
Explorer At Heart
Explorer At Heart
Posts: 260
Joined: Tue May 21, 2019 2:27 am
Gender: Male
Sexual Orientation: Asexual
I am a: Switch

Re: EOS Magpie - Eos Script Merging Tool

Post by Roblsforbobls »

Nothing against liver lol
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS Magpie - Eos Script Merging Tool

Post by fapnip »

Updated to allow tease JSON to be pulled from local JSON file as well as tease URL.
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS Magpie - Eos Script Merging Tool

Post by fapnip »

Added /*--magpie-warn [your message] */ Init Script comment detection so tease authors can display a message to those using Eos Magpie to rip things from their tease.
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS Magpie - Eos Script Merging Tool

Post by fapnip »

Fixed bug introduced in 0.2.7 that prevented download of merged script.
PowerBot
Curious Newbie
Curious Newbie
Posts: 4
Joined: Sun Mar 19, 2023 11:04 pm

Re: [EOS/TOOL] EOS Magpie - Eos Script Merging Tool

Post by PowerBot »

Thanks for this, huge help being able to transfer galleries and other content between teases!
User avatar
Morexis
Explorer
Explorer
Posts: 74
Joined: Sat Jun 29, 2019 11:25 pm
Sexual Orientation: Bisexual/Bi-Curious
Contact:

Re: [EOS/TOOL] EOS Magpie - Eos Script Merging Tool

Post by Morexis »

Is EOS Magpie broken or am I doing something wrong? Regardless which tease I enter, it always says "Unable to load tease URL" 😢

Image
🕹️ HAVE FUN PLAYING MY GAMES!

Join our Discord to get in contact with me and other hentai tease creators and players! 🤙
And please consider supporting me on Patreon for more content! 💖
Spoiler: show
Image

Creator of the MOST PLAYED tease in 2020 🥇
Creator of the fourth most played tease in 2020
Creator of the third most played tease in 2019
User avatar
indyc
Explorer At Heart
Explorer At Heart
Posts: 431
Joined: Sun Mar 28, 2021 10:03 pm
Contact:

Re: [EOS/TOOL] EOS Magpie - Eos Script Merging Tool

Post by indyc »

Morexis wrote: Fri Mar 08, 2024 5:16 pm Is EOS Magpie broken or am I doing something wrong? Regardless which tease I enter, it always says "Unable to load tease URL" 😢

Image
If you download your json and click the attachment looking symbol on the right of where you paste the link you can upload the json file and it will work. (It used to work from both link and raw json but now only json works) Reach out to me if you need more help!
Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests