Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Preventing Pagescripts from Affecting Items

4 years ago

So one of the major mechanics in my story is that gloal pagescripts cause re-viewed pages to have all the text greyed out and italicized, except for new comments by the protagonist (which are written in regular fonts). I've already coded this onto all of the pages, but realized recenty that this is also causing item descriptions to be greyed out and italicized when re-viewing the page. 

I don't want this to happen. So I tried using CSS in the item scripts to force the item description to have a regular font. This didn't work. I think this might be because item scripts are only set to run when a player 'uses' the item (which isn't the intention here - I never want the item descriptions to be italicized), or because pagescripts are set to run after item scripts. Next, I tried editing the HTML of the item description itself. This also didn't work. 

I've included some pictures to demonstrate what I'm talking about below. I would very much prefer a solution that doesn't involve editing the pagescripts, since I've already made them for over two hundred pages.

Sample page [seeing for the first time, item description open]:

Sample page: [seeing for the second time, item description open]

The Pagescript:

The HTML in the item description:

The code in the item script (I don't know if using "pagetext" is right, but there's no way to just put a 'style' command.)

Preventing Pagescripts from Affecting Items

4 years ago

Finally figured it out. Here's the solution, in case anyone is interested:

Edit: Just noticed the item links are still italicized. Was wondering if there's any way to get rid of these without using a global link script, since I've sometimes included italicized elements in links. Setting $LINKSCRIPT01 to have a normal font in the itemscript doesn't work. 

Preventing Pagescripts from Affecting Items

4 years ago
Link scripts are CYS scripts not HTML that effects the links. A solution that won't be as elegant as the one BD might provide sometime later would be to use css selectors and give the links some attribute of font-style: normal with an !important mixed in there so it persists.

Preventing Pagescripts from Affecting Items

4 years ago

Okay, thanks, but how do I do that for the individual links in the items? I want it to apply to all item links, but I don't want to use a global link script because I occasionally have italicized text in my main links. 

Preventing Pagescripts from Affecting Items

4 years ago
Reader, next time you have a technical problem like this you should tag the following people:

@BradinDvorak @Ogre11 @Killa_Robot @Chanbot


BerkaZerka could probably help too but he's pretty busy and online less.

I'm confident nobody else here has any idea what you're on about. Items aren't used often, for one thing, and most games don't do with html aside from the occasional bit if italics or bold. Although it looked like your global scripts were blank when I checked it just now. (I do see a couple of weird floating images on your scripts page though, not sure what's going on there...)

Preventing Pagescripts from Affecting Items

4 years ago

Hi Mizal, thanks. Yeah, I currently don't have any global scripts. I didn't want to apply a gloabl link script, because I do have a couple page links in the game that are purposefully italicized. 

I noticed that as well. Kind of strange - I blame the HTML in the RTE being a bit wonky. Those images are from the digital keypad I incorporated in my game. It works fine when you actually play through. 

Preventing Pagescripts from Affecting Items

4 years ago
Probably could've just put an !important on your item desc css but if you figured out a solutiong ood for you. Now would be a great time to tell you that items on CYS are jank as fuck and BD has previously worked on some custom JS item system. Dunno if he ever finished it but iirc he did some proof of concept stuff with it and it looked ezpz. Might be worth checking out.

Preventing Pagescripts from Affecting Items

4 years ago
<style>
table p {
  color: inherit;
  font-style: normal;
}
</style>

Preventing Pagescripts from Affecting Items

4 years ago

Oh, perfect. I'll try implementing this as a global page script. 

Edit: It worked. Thanks!