Author Topic: Script conversion to XML Progress  (Read 7483 times)

0 Members and 1 Guest are viewing this topic.

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Script conversion to XML Progress
« on: February 08, 2015, 01:06:29 PM »
I finally got back to this 2 years later.

Currently working with .06.03.06:

Basically when editing scripts you need to start with 4 things ready:
1. Start the game and get to the part where you use the script (start a new game and call it Cheat to activate cheat mode so you can use the scripts as many times as needed)
2. Load the script in the script editor
3. Open the /Resources/Scripts folder
4. Load the .scriptx in a text editor (I prefer Notepad++)

(make backups of your scripts)

Start by making the script in the editor and save the .script file
Go to the folder and delete the .scriptx file.
Run the script in the game, this will rebuild the .scriptx file
If you are using Notepad++ it will ask if you want to reload the file, do so and edit the new xml .scriptx, Save changes.
Delete the .script file from the folder.
Run the script in the game to rebuild the .script file.
Reload the .script file in the editor.


Script commands that have variables
Script commands without variables






Old Post


Moved this from http://www.pinkpetal.org/index.php?topic=3481.msg32990#msg32990

I am in the process of converting Scripts from Binary to XML.
Check back here for progress updates.

I started adding dates for when things get done. (3/15/15)

Done > Mostly Done > Working on it > Ready to start > Not started

1)  Get the Game to Duplicate the scripts
- 100%
I have been looking at the code for it and have gotten the game to duplicate the scripts in binary.

2)  Get the Game to Save the scripts in XML - 100%
I now think I can figure out how to get it to save the binary scripts into XML.
It saves the Root, now I just need to get it to parse the choices.
It saves everything but just as numbers.
 - I may change it later to make it human readable so you can edit it with a text editor without needing a key.
Attached Second draft of working "MeetTownDefault - numbers.scriptx" just to look at, things will change so it will not work in the game.
 - (first draft is still in the old post.)

3)  Get the Game to Read the XML scripts. - 100%
The game will prefer the XML over the binary unless the XML is broken.
 - (Broken Binaries are another matter.)
 - It will automatically convert any binary script to XML when it finds it.
The game reads the XML - now I just need to have it parse it.
I was having some problems crashing the game but I got them fixed.

Ok, I am seeing some delay when the game loads large scripts.
 - Because of this, I am making the game prefer the binary scripts again.
 - If you want the game to load a .scriptx file, delete or rename the .script file it replaces.
 - The game will see this and recreate the binary.
 - This will make editing the scripts(x) easier because it reloads it each time it is called without having to reload the game.
 - If the Binary is found but the XML is not, it will create the XML and vice versa.
 - If the .script is XML, the game will create the XML as .scriptx and rewrite the .script to binary.

While running the comparison from the original Binary > convert to XML > convert back to Binary, there are 2 bytes that change and I can not figure out why.
So far it doesn't seem like it makes a difference but it just bugs me.
I tested this on 6 files so far, 4 were identical after conversion, 2 had the exact same problem as above.
I am just going to assume that the originals are the problem and let it go.

Use *GIRLNAME* to have the game replace it with the girl's name

First draft is in .06.01.01

4)  Get the Editor to Read the XML scripts. - 50%
It loads the .scriptsx files but does not do anything with it.

4b) Get the Editor to Read the Binary scripts. - 50%
I have started the load binary by copying the game's load binary into the editor. (3/15/15)
It now fully loads binary scripts. (3/16/15)

5)  Get the Editor to Save the XML scripts. - 50%
I have started the save XML by copying the game's save XML into the editor. (3/16/15)
The editor now saves XML scripts but needs to be tested a bit. (3/21/15)


5b) Get the Editor to Save the Binary scripts. - 0%
I have started the save binary by copying the game's save binary into the editor. (3/16/15)


6)  Get the Editor to Edit the scripts. - 10%
I have added a table to allow for simple editing but have not made it save yet. (3/15/15)


7) Change the XML to save as "Human Readable" instead of just numbers. - 0%
« Last Edit: January 07, 2018, 11:46:39 AM by aevojoey »
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline MuteDay

  • Sr. Member
  • ****
  • Posts: 421
  • Loving life and PinkPetal Family
Re: Script conversion to XML Progress
« Reply #1 on: February 08, 2015, 01:11:19 PM »
Moved this from http://www.pinkpetal.org/index.php?topic=3481.msg32990#msg32990

I am in the process of converting Scripts from the Binary to XML.
Check back here for progress updates.

Done > Mostly Done > Working on it > Ready to start > Not started

1)  Get the Game to Duplicate the scripts
- 100%
I have been looking at the code for it and have gotten the game to duplicate the scripts in binary.

2)  Get the Game to Save the scripts in XML - 90%
I now think I can figure out how to get it to save the binary scripts into XML.
It saves the Root, now I just need to get it to parse the choices.
It saves everything but just as numbers.
 - I may change it later to make it human readable so you can edit it with a text editor without needing a key.
Attached first draft of working "MeetTownDefault - numbers.scriptx" just to look at, things will change so it will not work in the game.
The game will automatically convert any binary script to XML when it finds it.
 - It will then prefer the XML over the binary unless the XML is broken.
 - Broken Binaries are another matter. (will fix that if it is found)

2b) Change the XML to save as "Human Readable" instead of just numbers. (optional) - 0%


3)  Get the Game to Read the XML scripts. - 0%


4)  Get the Editor to Read the XML scripts. - 0%


4b) Get the Editor to Read the Binary scripts. (optional) - 0%


5)  Get the Editor to Save the XML scripts. - 0%


5b) Get the Editor to Save the Binary scripts. (optional) - 0%


6)  Get the Editor to Edit the scripts. - 0%


since the game uses lua, you may try luainterface or its c++, which will allow you to read the scripts as text files, which will give some speed

Please Enjoy all the hard work i Do to help make the game and forums a better place :)

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Script commands that have variables
« Reply #2 on: February 08, 2015, 01:30:23 PM »
Script commands that have variables

SET: How it is listed in the Script editor txt file
SEE: How it is shown in the script editor
<Action> example of how it is used in the .scriptx file
Notes: Notes

Dialog
SET 0: "Dialog ~"
SEE 0: Dialog [*TEXT*]
<Action Type="Script_Dialog" Text="What would you like to do?" />

Creating Choice Boxes
SET 5: "CHOICEBOX ~ ~"
SET 6: "TEXT ~"
SEE 5: CHOICEBOX [*0*] [*0*]
SEE 6: TEXT [*TEXT*]

<Action Type="Script_ChoiceBox" ID="2" Num="4" />
<Action Type="Script_m_Next" Text="Have Sex" />
<Action Type="Script_m_Next" Text="Ask her to have sex with another girl" />
<Action Type="Script_m_Next" Text="Ask her to have sex with a beast" />
<Action Type="Script_m_Next" Text="Ask her to be in a bondage session" />

Notes: Num is the number of choices in the box and there needs to be that many Script_m_Next

Using Choice Boxes
SET 12: "ActivateChoice ~"
SET 13: "If Choice from ChoiceBox ~ is ~"
SEE 12: ActivateChoice [*0*]
SEE 13: If Choice from ChoiceBox [*0*] is [*0*]

<Action Type="Script_ActivateChoice" ID="2" />
Notes: This triggers the choicebox with that ID to run

<Action Type="Script_IfChoice" ID="2" Val="0" />
<Action Type="Script_EndIf" />
Notes: If Choice from ChoiceBox ID is Val. (The first item has a VAL of 0, second is 1, third is 2, and so on)

Script variables (Var)
SET 7: "SetVar ~ ~"
SET 8: "SetVarRandom ~ ~ ~"
SET 9: "IfVar ~ ~ ~"
SEE 7: SetVar [*0*] [*0*]
SEE 8: SetVarRandom [*0*] [*0*] [*0*]
SEE 9: IfVar [*0*] [*EqualTo*] [*0*]

<Action Type="Script_SetVar" Var="0" Val="100" />
<Action Type="Script_SetVarRandom" Var="4" Min="0" Max="3" />
<Action Type="Script_IfVar" Var="0" Compare="e" Amount="100" Info="Compare Options:   e , l , le , g , ge , ne" />

Player Stuff
SET 14: "SetPlayerSuspicion ~"
SET 15: "SetPlayerDisposition ~"
SEE 14: SetPlayerSuspicion [*0*]
SEE 15: SetPlayerDisposition [*0*]
<Action Type="Script_SetPlayerSuspicion" Val="-20" />
<Action Type="Script_SetPlayerDisposition" Val="-20" />

Gold
SET  21: "AddRandomValueToGold ~ ~"
SET 102: "GiveGoldToGirl ~ ~"

Stats and Skills
SET  24: "AdjustTargetGirlStat ~ ~"
SET  27: "IfPassSkillCheck ~"
SET  28:  "IfPassStatCheck ~"
SET  31: "IfGirlStat ~ ~ ~"
SET  32: "IfSkill ~ ~ ~"
SET  82: "AdjustTargetGirlSkill ~ ~"
SET 103: "AdjustTargetGirlStatR ~ ~ ~ ~"
SET 104: "AdjustTargetGirlSkillR ~ ~ ~ ~"

Note: #24 AdjustTargetGirlStat was in the original script editor and it was used for both stats and skills.
 .06.03.06 corrects this by splitting skills out and making them use AdjustTargetGirlSkill instead.


Traits
SET  33:  "IfHasTrait ~"
SET  71:  "AddTrait ~"
SET  72:  "RemoveTrait ~"
SET  73:  "AddTraitTemp ~ ~"
SET  81:  "AdjustTraitTemp ~ ~"

Items
SET  95: "IfGirlHasItem ~"
SET  96: "AddItemtoGirl ~ ~ ~"
SET  97: "GivePlayerItem ~ ~"
SET  98: "IfPlayerHasItem ~"
SET  99: "GiveGirlInvItem ~ ~"

Status
SET 106: "IfGirlStatus ~ is ~"
SET 107: "SetGirlStatus ~ to ~"

Pregnancy
SET 109: "CreatePregnancy type ~ chance ~ force ~"

Other stuff
SET  17: "AddCustomerToDungeon ~ ~ ~"
SET  18: "AddRandomGirlToDungeon ~ ~ ~ ~ ~ ~ ~"
SET  22: "AddManyRandomGirlsToDungeon ~ ~ ~ ~ ~ ~ ~"
SET  70: "AddFamilyToDungeon ~ ~ ~ ~ ~ ~"
SET  78: "Get Random Girl ~ ~"

Script Flags
SET  19: "Set Global ~ ~"
SET  16: "ClearGlobalFlag ~"
SET  20: "SetGirlFlag ~ ~"
SET  29: "IfGirlFlag ~ ~ ~"
SET  80: "AdjustGirlFlag ~ ~"
Note: These don't seem to be used but they are here for completion





since the game uses lua, you may try luainterface or its c++, which will allow you to read the scripts as text files, which will give some speed
But then I would have to learn another language.  :'(

I already know XML pretty well and most other things in the game use it, so I will keep using XML.
« Last Edit: January 06, 2018, 02:42:50 PM by aevojoey »
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline MuteDay

  • Sr. Member
  • ****
  • Posts: 421
  • Loving life and PinkPetal Family
Re: Script conversion to XML Progress
« Reply #3 on: February 08, 2015, 01:48:37 PM »
learn alother language? it will use same language as the sripts use now as is

Please Enjoy all the hard work i Do to help make the game and forums a better place :)

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Script commands without variables
« Reply #4 on: February 08, 2015, 02:17:01 PM »
Script commands without variables

System commands
###.scriptx.script
1Script_InitINIT
2Script_EndInitENDINIT
3Script_EndScriptENDSCRIPT
4Script_RestartRestart
30Script_GameOverGameOver
Modifier Commands
###.scriptx.script
23Script_AddTargetGirlAdd Target Girl
25Script_PlayerRapeTargetGirlPlayerRapeTargetGirl
26Script_GivePlayerRandomSpecialItemGivePlayerRandomSpecialItem
35Script_ScoldTargetScold Target Girl
108Script_EndPregnancyEndPregnancy
If commands
###.scriptx.script
40Script_IfNotDisobeyIf Not Disobey
100Script_IfGirlIsSlaveIfGirlIsSlave
101Script_IfGirlIsFreeIfGirlIsFree
10Script_ElseElse
110Script_ElseNewElseNew
11Script_EndIfEndIf
105Script_EndIfNewEndIfNew
Show Image
Use these to show the image type in the name.
Many of these also have a small stat/skill adjustment related to its image type.
Most of the sex images will check virginity and pregnancy.
###.scriptx.script
34Script_TortureTargetTorture Target Girl
36Script_NormalSexTargetHave Normal Sex
37Script_BeastSexTargetHave Beast Sex
38Script_AnalSexTargetHave Anal Sex
39Script_BDSMSexTargetHave Bondage Sex
41Script_GroupSexTargetHave Group Sex
42Script_LesbianSexTargetHave Lesbian Sex
43Script_OralSexTargetHave Oral Sex
44Script_StripTargetHave Strip
45Script_CleanTargetHave Clean
46Script_NudeTargetHave Nude
47Script_MastTargetHave Mast
48Script_CombatTargetHave Combat
49Script_TittyTargetHave Titty
50Script_DeathTargetHave Death
51Script_ProfileTargetHave Profile
52Script_HandJobTargetHave Hand Job
53Script_EcchiTargetHave Ecchi
54Script_BunnyTargetHave Bunny
55Script_CardTargetHave Card
56Script_MilkTargetHave Milk
57Script_WaitTargetHave Wait
58Script_SingTargetHave Sing
59Script_TorturePicTargetHave Torture Pic
60Script_FootTargetHave Foot
61Script_BedTargetHave Bed
62Script_FarmTargetHave Farm
63Script_HerdTargetHave Herd
64Script_CookTargetHave Cook
65Script_CraftTargetHave Craft
66Script_SwimTargetHave Swim
67Script_BathTargetHave Bath
68Script_NurseTargetHave Nurse
69Script_FormalTargetHave Formal
74Script_ShopTargetHave Shop
75Script_MagicTargetHave Magic
76Script_SignTargetHave Sign
77Script_PresentedTargetHave Presented
79Script_DomTargetHave Dominatrix
83Script_DeepTargetHave Deep
84Script_EatOutTargetHave EatOut
85Script_StrapOnTargetHave StrapOn
86Script_Les69ingTargetHave Les69ing
87Script_DildoTargetHave Dildo
88Script_SubTargetHave Sub
89Script_LickTargetHave Lick
90Script_SuckBallsTargetHave SuckBalls
91Script_CowGirlTargetHave CowGirl
92Script_RevCowGirlTargetHave RevCowGirl
93Script_SexDoggyTargetHave SexDoggy
94Script_NormalSexWithRandomTargetHave NormalSexWithRandom
111Script_BrandTargetHave Branding
112Script_RapeTargetHave Rape
113Script_RapeBeastTargetHave Beast Rape
114Script_BirthHumanTargetHave Human Birth
115Script_BirthHumanMultipleTargetHave Human Birth Multiple
116Script_BirthBeastTargetHave Monster Birth
117Script_ImpregSexTargetHave Impregnate Sex
118Script_ImpregGroupTargetHave Impregnate Group
119Script_ImpregBDSMTargetHave Impregnate Bondage
120Script_ImpregBeastTargetHave Impregnate Beast
121Script_VirginSexTargetHave Virgin Sex
122Script_VirginGroupTargetHave Virgin Group
123Script_VirginBDSMTargetHave Virgin Bondage
124Script_VirginBeastTargetHave Virgin Beast
125Script_EscortTargetHave Escort
126Script_SportTargetHave Sport
127Script_StudyTargetHave Study
128Script_TeacherTargetHave Teacher






Old post
learn alother language? it will use same language as the sripts use now as is
The scripts currently use binary as their language.
While exactly 1 script (Intro.lua) uses the Language called LUA, I don't know it well enough to use it.
I know XML well.
.girlsx, .rgirlsx, .itemsx, .traitsx, config.xml and every interface xml all use XML, .scriptsx will as well.
If you want to write the code to load, save and edit lua, go ahead.
I will use XML.
« Last Edit: January 07, 2018, 12:08:19 PM by aevojoey »
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline GonDra

  • Full Member
  • ***
  • Posts: 154
Re: Script conversion to XML Progress
« Reply #5 on: February 10, 2015, 08:47:41 AM »
It has been a long time since I looked at the code, but from what I remember the lua implementation was very bare-bones and never included the hooks necessary for girl scripts.
If I remember right it was Doc who worked on that and he had a fork on the official svn where his half done lua implementation was saved, he had to leave it at that because of real life interference sadly.

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Re: Script conversion to XML Progress
« Reply #6 on: February 13, 2015, 01:03:38 AM »
So I got WME to read the scripts and throw it out in a text window.
I have not added the save script yet, but should have that tomorrow unless something comes up. something came up :'(
« Last Edit: March 05, 2015, 11:36:14 AM by aevojoey »
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Re: Script conversion to XML Progress
« Reply #7 on: March 16, 2015, 01:25:51 AM »
I have started working on this again.
It is slow going but I am making progress.
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Re: Script conversion to XML Progress
« Reply #8 on: March 22, 2015, 12:52:00 AM »
Real life kept me away from working on the game or editor for several days but I got back and after some hassle, I got the editor to save xml scripts.
I need to check it a bit to make sure it loads and saves the same thing over many attempts but it looks promising.
As for binary scripts, I will work on saving them after I make sure xml saving works.

A functional albeit clunky text and numbers only version should be out tomorrow.
Real life requires me to push back the more advanced parts of the script editor a few more days (hopefully not weeks).
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline MuteDay

  • Sr. Member
  • ****
  • Posts: 421
  • Loving life and PinkPetal Family
Re: Script conversion to XML Progress
« Reply #9 on: March 29, 2015, 03:31:32 PM »
well as far as the editor comes, if you pm me a list of features you are looking to do i should be able to help out, found out my pc isnt as bad as i though, and i would look forword to helping out
Please Enjoy all the hard work i Do to help make the game and forums a better place :)

Offline Anonemuss

  • Newbie
  • *
  • Posts: 20
Re: Script conversion to XML Progress
« Reply #10 on: April 13, 2015, 10:10:02 AM »
Script editing has always been a pain in this game. I'd love to see this program completed; it would make script editing so much easier!

Offline aevojoey

  • Hero Member
  • *****
  • Posts: 1413
  • Thats ok, I'm used to disappointment.
Re: Script conversion to XML Progress
« Reply #11 on: January 06, 2018, 12:35:36 PM »
I've come back to this 2 years later  :'(
I will be adding more to this thread this week.
Fixing the game is a better game than actually playing it.
Get the Current Version <|> Discuss the Game <|> Report a bug

Offline grishnak

  • Jr. Member
  • **
  • Posts: 70
Re: Script conversion to XML Progress
« Reply #12 on: January 06, 2018, 07:24:52 PM »
Being able to expand or modify scripts with a text editor and "copy/paste" would be a great improvement to the editor. This looks promising :)