Tutorial RAGS Regalia - Enhanced RAGS 2.x Player For The Browser

5.00 star(s) 2 Votes

selectivepaperclip

Active Member
Modder
Respected User
Donor
Feb 19, 2017
524
3,400
The only reason I want the original is so i can play it in debug mode (as I do for all Rags games), is it possible to do that in your web version?
One of the builtin features of Regalia is to allow the editing of all game variables; the "Cheat" menu in the upper right should be very similar to the "debug" menu in RAGS.
regalia-apartments.png
 
  • Like
Reactions: Davox

coretex

Active Member
Jun 15, 2017
568
479
I made a response on the Cursed forum thread in regards to a few components that dont seem to work right so far with that specific game with the regalia version selectivepaperclip posted over there.


Mainly that the clothing tailoring function and the book shelf cleanup function doesnt seem to work at all.
Also just in general, that the Regalia cheat panel, in comparison to Rags own debug menu method, there are many other properties and variables that Regalia's cheat menu does not list.

What are the chances that these are something fixable within the Java/JScript Regalia uses, versus this being more of an export issue from Rags Designer?
 

selectivepaperclip

Active Member
Modder
Respected User
Donor
Feb 19, 2017
524
3,400
What are the chances that these are something fixable within the Java/JScript Regalia uses, versus this being more of an export issue from Rags Designer?
It's extremely likely to be fixable within Regalia, usually the issue is something where the JavaScript code doesn't behave exactly like the Windows client for some edge case, like comparing against the value of a declared variable against an undeclared one or somesuch.

Usually issues with the export cause the game to not load at all, otherwise they're all workaroundable.

It's easiest for me to fix if you:
  • provide an exported savegame right before the thing that did not work
  • say what you were trying to do, e.g. "use the 'sleep' action on the bed"
  • say what you expected to happen, e.g. "the day should increase by 1"
  • say what actually happened, e.g. "the day stayed the same"

Also if you said what specific variables are showing up in the RAGS debugger but not in Regalia's variable list I could work on that too.
 

coretex

Active Member
Jun 15, 2017
568
479
Ok so heres some files and details:

So the xls file contains a c/p from the debug window using rags 2.5.2 (i have 2.4.16 and 2.6 as well, i wanted to know if 2.5.2 would make the game work better than it did in the past or not. It wont even load correctly on 2.6).

Thankfully you can c/p from the debug window in the first place.. and dropped it into a spreadsheet view just for clarity, else a text file mashup would not have been pretty. Mostly the Cheat menu in Regalia, lists most if not all of the items in the Variables tab of the xls... there might be some exceptions but theres a ton of entries. (I do like how Regalia shows descriptions, vs Rags not giving you a clue.) The Custom Properties tab in the xls, lists everything else that shows up in the Custom Properties tab in the debug window in Rags.. which has got all the item values, some other variables and timers and etc. The values are named really weird in some cases (probably due to Rags' oddball coding) so thinks like.. bath salts.. have a "bust size" but from what I was able to determine, is actually treated as "amount owned by player". So theres various items in the game, where you can have multiple of.. and apparently thats where those values goes. It then seems for all the clothing type items, thats the "target size" for the item, along with some items have upper and lower allowed sizes, that factors into the Tailoring mechanic in the game, as the player's body changes. If the player exceeds the upper or lower size restrictions, they cant wear the item and needs to get it Tailored (if its clothing) or go and buy new underwear if its underwear.

Which that goes into the next part;
In the exported saves theres Tailor issue and Tailor issue 2, which I modified the current game state to replicate the "player body has changed, clothes wont fit, needs to be tailored" issue. There are workout clothes and the robe that fit regardless hence what you will see in the save.
Tailor Issue save:located at the mall, at the Tailor shop.. where if you choose any of the options.. what happens in Rags, is depending on choice, it lists the item having been "worked on" in the Text readout, and the item is actually changed behind the scenes. Its "bust size" value gets changed, and for ones appropriate, has its upper and lower allowed sizes also changed.
None of this seems to happen in the Regalia version. You talk to the Tailor, hit whatever option (all should be fine), nothing gets listed in the readout that its worked on, and leaving the mall, going back into the bedroom, to open the closet, take off the current clothes, and then try just about anything else on.. nothing will fit.
Tailor Issue 2 save is just me having done the "all" option at the Tailor, and already back at the apartment trying to put on the non-workout clothes and nothing is working.

The Bookshelf issue save:
That is in the main center "living room" of the apartment having bought a bunch of the magazine/book/cd crap at the mall and after having bought the bookcase at the mall as well, and when at home, theres a "clean up" option, which should go and grab all that stuff thats dumped into the living room inventory space, and grab it inside of the book case, so when its set to (closed) it doesnt take up a bunch of list space. Otherwise those items itself work. This one is more cosmetic than actual functional breakage, so its not super critical, but it is what it is.

and pardon the .txt on the files.. not trying to circumvent F95's file uploading rules, but it doesnt like non-supported file types.
 

selectivepaperclip

Active Member
Modder
Respected User
Donor
Feb 19, 2017
524
3,400
Ok so heres some files and details:
Thanks for your detailed notes! It was easy to track down the problem with those.

Unfortunately, the issues with the Tailor and the Bookshelf really are problems with the RAGS export feature.

Both actions make use of the game's "Item: In Group" test, and unfortunately the export code in the windows RAGS client doesn't include item group names in the exported data at all. So far, Cursed is the first game I've tested that has used the "Item: In Group" functionality.

The true fix requires hacking RagsLib.dll to add group names to the exported data somewhere. Doing this properly would be pretty hard, because technically "Item: In Group" should work for any level of group nesting.

Another simpler, but brittle fix, is to hack the data back in on a game-by-game basis with game-specific Regalia patches.

If you add this content to the end of the file "Cursed 0.5.3.2/regalia/game/Game.js" (before "return TheGame") it should fix the bookshelf and tailor features for now:
Code:
var cursedObjectGroups = {
  'bookshelf things': [
    'Basics of Parenting',
	'Cosmopolitan Magazine',
	'dance DVD',
	'Handsome And Handy',
	'Hustler magazine',
	'leather-bound tome',
	'Light Feet',
	'martial arts DVD',
	"Men's Health magazine",
	'Office Environments For Imbeciles',
	'Parenting for Dummies',
	'Poker Face',
	'Sex Herald magazine',
	'Style Magazine',
	'Waving the Flag',
	"What to Expect When You're Expecting",
	"Women's Health magazine"
  ],
  'casual clothes new': [
	'flirty clothes',
	'floral print dress',
	'jumpsuit',
	'nun outfit',
	'purple belted dress',
	'special outfit',
	'tanktop and shorts',
	't-shirt and capris',
	't-shirt and jeans',
	'white cotton dress'
  ],
  'maternity clothes': [
	'flirty maternity clothes',
	'maternity dress',
	'sexy maternity clothes',
	'stretchy shirt and pants'
  ],
  'professional clothes': [
	'black dress with white jacket',
	'black halter vest top and skirt',
	'black v-neck dress',
	'blouse and pants',
	'grey pantsuit'
  ],
  'sexy clothes': [
	'asymmetrical mini dress',
	'black cutaway gown',
	'cheerleader outfit (reward)',
	'elegant dress',
	'japanese maid outfit',
	'leather dress'
  ],
  'slutty clothes': [
	'club clothes',
	'fishnet mini dress',
	'french maid outfit',
	'latex keyhole dress',
	'secretary outfit',
	'slutty schoolgirl outfit (reward)',
	'waitress uniform (reward)'
  ],
  'utilitarian clothes': [
	'form-fitting clothes',
	'robe',
	'sweatsuit'
  ]
}

Object.keys(cursedObjectGroups).forEach(function (groupName) {
  var objectsInGroup = cursedObjectGroups[groupName];
  for (var i = 0; i < objectsInGroup.length; i++) {
    Finder.object(objectsInGroup[i]).GroupName = groupName;
  }
})
That won't fix everything wrong with the game, it looks like there are other features in the game that need GroupName to be possibly assigned. But it's an example.

As for the missing Custom Variables in the debug mode, that could definitely be added to Regalia, it would just take some time to design and implement.
 
  • Like
Reactions: gue5t and coretex

coretex

Active Member
Jun 15, 2017
568
479
Thanks for the reply and the patch.
Did a quick test and so far so good.

Yea Cursed is the only Rags game i have played that had some unique inventory functions like that, so doesnt surprise me it was an edge case for the html exporter.
I think the other functions that appear to use it might be the preset clothing categories for quick wear, but, at least with some basic testing those have seemed to work. Haven't gotten far enough into the game on the Regalia version yet to encounter anything else yet. The only things i can think of though might be some of the inventory management that comes with the waitress/stripper job thats in the game, and maybe the lab break-in mission. Will just have to wait and see.
As for the extra variables thing, yea that will be nice to see eventually, so will be looking forward to that in Regalia down the line.

Having just recently deciding to check back with some Rags based games, finding the post about enabling debug mode in Rags, and then finding your post about Regalia, and how it makes playing Rags so much easier, I might actually get back and enjoy these kind of games again. May have to check out some of your other pre-converted ones, so thank you for all of it.
 

coretex

Active Member
Jun 15, 2017
568
479
Now that Im trying to keep a closer eye on things.. noticed Cursed with Regalia, doesnt update the "Day/Date" correctly.
Game starts in march 30th 2012, and through the intro is supposed to move onto the begining of april, and list out what day of the week it is.. and.. it doesnt even list the day of the week and the game stays listed at 3-30-2012. Going into Cheats, the variables for Day of the Week and number of days passed in game is right.

And.. going from earlier.. The clothing system, where you can set "x items as a clothing set" does work mostly.. but coming up with a bug now, that one of the items, after Tailoring, works only if I manually go to wear it, having it try to automatically do it from the saved clothing set, complains that the item doesnt fit correctly. - Edit... Theres a few other clothing items with random size issue "complaints" in the game.. like "x item wont fit due to x body difference" and in some cases it wears it anyway, some it wont.. but then going back to manual wearing of the item.. doesnt seem to occur. Its got to be export issues from Designer.
 
Last edited:

selectivepaperclip

Active Member
Modder
Respected User
Donor
Feb 19, 2017
524
3,400
Game starts in march 30th 2012, and through the intro is supposed to move onto the begining of april, and list out what day of the week it is.. and.. it doesnt even list the day of the week and the game stays listed at 3-30-2012.
Thanks again for the detailed report. This one makes sense: date add/subtract commands have never been implemented in the original RAGS JavaScript code or Regalia, so it failed to add 1 to the date on sleep.

I've implemented those commands as well as better date formatting, so the date should show up in the statusbar with this version:
Note that it only affects future sleeps - if you load a save, the date will still be inconsistent.

Date comparison commands ("is date1 the same weekday as date 2") are still not implemented, but Cursed doesn't seem to use those so it shouldn't be an issue.

As for the clothing fitting issue, it would probably be easier to diagnose if you gave me a save and instructions like before.
 

coretex

Active Member
Jun 15, 2017
568
479
I will check that one out for the dates soon.

As for the clothing thing.... yea im getting odd comments from a few combos, and i cant tell if its the item attributes not getting updated, or just a bug with the "presets" system. That might be a bit harder to get you good examples of.
 

coretex

Active Member
Jun 15, 2017
568
479
Ok.. So Date listing/Day of the week listing seems good now - Having looked at Regalia, vs Rags, and having seen some of the variables with the cheat menu and debug menu, and what you posted as the fix and what the game/rags was trying to do...very odd how the game doesnt just update that display directly, it keeps track of the date/day on its own behind the scenes, then just tells the time display to .. Plus1?? seriously??

And yes, confirmed it does need a new game.. as my guess is there doesnt seem to be any check in the game's own code to validate the displayed date versus internally tracked date, so its all jacked up unless you start over.

Anyway.

as for the clothing thing.. ok.. while im probably not catch every instance of this.. by starting over, created a separate game with just the 2 test cases iv seen so far.
So with this one, edited the stats i needed in order to be able to buy the clothes near game start. This in no way affects the body shape/size stats that the messages complain of;

So in the save, if you go to the "Get Dressed" function of the closet, choose Test 1.. it is supposed to put on the mini dress. It complains it doesnt fit right and wont do it. If you open the closet and manually wear it.. works fine... no complaints.
In "Get Dressed" Test 2 - its set to put on the purple dress. - which it does, no complaints. If you go and manually put it on, then it complains, but, puts it on anyway.
In the case of the purple dress, its even more odd when there is an actual body size reason (seems only weight/bust affect if it fits or not), you get the same one complaint about bust size, and then it either duplicates the same set of text or adds in weight reason that it wont fit.
 

gue5t

Active Member
Sep 11, 2016
594
1,026
Code:
    var shortMonths = [
        'Jan',
        'Feb',
        'Mar',
        'Apr',
        'Jun',
        'Jul',
        'Aug',
        'Sep',
        'Oct',
        'Nov',
        'Dec'
    ];
Might be wrong but shouldn't there be May in between Apr & Jun?
 

coretex

Active Member
Jun 15, 2017
568
479
Lol probably.. had not gone that far in the new game since starting over.

I see what you mean in the DateTimes.js file.. now.. may is already "short".. so maybe thats why?.. course.. looking through the rest of the file.. i have no idea how to understand java code.. but it seems it probably needs it regardless?
I edited my own local copy of regalia w/ cursed.. but is this something that will actually be needed for all games?
 

selectivepaperclip

Active Member
Modder
Respected User
Donor
Feb 19, 2017
524
3,400
very odd how the game doesnt just update that display directly, it keeps track of the date/day on its own behind the scenes, then just tells the time display to .. Plus1?? seriously??
RAGS provides some reasonable date/time printing and comparison functions, but I think most game makers either don't know about them or find them lacking, so they end up doing the double-bookkeeping like Cursed is doing. It independently tracks the current DateTime as well as the number of days since the start of the game, which is annoying since it makes it possible for them to be out of sync if the developer forgets to update both of them every place that a time shift happens. Oh well.

if you go to the "Get Dressed" function of the closet, choose Test 1.. it is supposed to put on the mini dress. It complains it doesnt fit right and wont do it. If you open the closet and manually wear it.. works fine... no complaints.
I did some spelunking, and this one seems to be a bug in the game. I'm not sure it actually works in the windows RAGS client.

The code for putting on the dress individually looks like this:
CURSED-dress-wear-individual.png
And the code for putting on the dress in an outfit looks like this:
CURSED-dress-wear-group.png

Note the extra square bracket in "[[v: Weight]" -- that means it compares the dress' "fitness low" property against a weight value like "[50", which does not match. I thought it might be possible that the windows RAGS client allows all matches like "'50' == '[50'" to pass, which is behavior I could add to Regalia, but in my testing on a smaller test game that didn't seem to be true.

In "Get Dressed" Test 2 - its set to put on the purple dress. - which it does, no complaints. If you go and manually put it on, then it complains, but, puts it on anyway.
In the case of the purple dress, its even more odd when there is an actual body size reason (seems only weight/bust affect if it fits or not), you get the same one complaint about bust size, and then it either duplicates the same set of text or adds in weight reason that it wont fit.
In this case the code for wearing the purple dress individually and in a group seem to have diverged: in the individual code. The code for wearing it individually contains an extra section comparing 'fitness high' to 'Breast Pos', which I think is a bug because it looks like normally object 'fitness' is compared to character 'Weight' and object 'bust size' is compared to character 'Breast Pos'
CURSED-purple-dress-fitness-bust.png

In either of these cases if you think the behavior does really work in the Windows RAGS client I can give it a second look.

Really, the code dealing with clothing in this game is absolutely Hell on Earth. I think RAGS seduces people into making an ambitious game with all the clicking and dragging, but then they end up with a monstrosity like this
CURSED-hell-on-earth.png

With copy-pasted code at every step in the tree like this
CURSED-hell-on-earth-2.png

It's a maintenance nightmare and it's no wonder things get out of sync.
Though in fairness the code for No Haven is probably even more confusing!

Might be wrong but shouldn't there be May in between Apr & Jun?
For sure, thanks for the code review.

The only game I've seen DateTime stuff in so far is Cursed, and as far as I know it only shows the "fullMonths" instead of the "shortMonths". So I don't think it's causing much of a problem, but I'll put this fix in the next release.
 
  • Like
Reactions: gue5t

coretex

Active Member
Jun 15, 2017
568
479
Yea i was starting to wonder after the tests that it was probably a bug in the actual game itself. I dont recall these in previous version of the game, prior to 5.3.2, at least around version 4. I had not revisited the game in quite a while before finding the "newer" 5.3.2. I do remember looking briefly into the 4.0 unlocked version that AnonMan had put out (prior to knowing/finding the way to get around locked files, i haven't hex edited designer yet to do that) and looking at the same kind of thing you are in the snippets.. and going.. holy hell, so yea.. i totally get that. Il have to test with the windows version at some point.. but I'm more in-line with you thinking that those are just typos in the game code itself (extra chars, wrong properties), but i do think the windows client either does some fudging or fuzzy logic to certain things, so who knows.
I would think that if in comparison to the other "working" items.. I'm leaning towards game code typos.

Just a quick look through the game.js file... oh brother the folly of copy/paste bad code.. so yea.. that extra bracket is propagated through every check for that dress. and for the other one.. yea that wrong check is propagated in a few places as well.
So.. not expecting you to fix game code, its not your game.

To experiment though.. went and edited the js file with the suspected corrections.. (thank you notepad++ search/replace).
Loaded up the test save I made in Regalia (can i say for maybe 2nd time.. the export/import you coded for it is awesome).... both manual and outfit runs then worked without messages/complains, at least as long as character attributes are within the "tailoring mechanic ranges" for those 2 items.

Doesn't surprise me Cursed is a buggy/code-hell mess ;) Lives up to its name.

Thanks for digging through all of that anyway.. appreciated.
 
  • Like
Reactions: selectivepaperclip

selectivepaperclip

Active Member
Modder
Respected User
Donor
Feb 19, 2017
524
3,400
how do I attack???
I actually haven't managed to make it all the way through Mindshift in Regalia, so you probably hit a bug.

I can try to look into it some this weekend, but it would be easier to fix if you provided an exported savegame from before this scene.
The sinner game
New version has appeared

Thanks for the heads up! Here's the Regalia version:

and the most recent Regalia code itself for anyone who wants to upgrade an earlier posted game
 
5.00 star(s) 2 Votes