Changing Margin Color and Pane Theme (Solved)

Io
02 Feb 2019, 02:49

So at one point in my game, I want to change the color of the screen via code. However, the simple 'change background change foreground' stuff doesn't work for me. What I want is code that will change the color of the text, the color of the background, AND the color of the margins, AND change the style of the panes from one to another ingame.

I can get half of these to work. I can make the background and foreground - text color - change to the right stuff. But the margins don't change - they stay white, and I made sure that Color Blend For Background is off - and the panes don't change - they don't go from Classic to Midnight.

The code I tried for those was:

game.marginscolour="Black"
game.panestheme="Midnight"

But it did nothing. Please advise.


Forgewright
02 Feb 2019, 06:46

SetBackgroundColour(string colour)

See here
http://docs.textadventures.co.uk/quest/scripts/request.html


Io
02 Feb 2019, 16:15

No, that's not the problem. SetBackGroundColour is what I'm using, and it works, but I'm also trying to set the margin color.

At any rate I just found what I was looking for for that:

JS.setCss("body","background:black")

However, now I still cannot find how to change the Pane Theme in the middle of the game.


Forgewright
02 Feb 2019, 20:14

how about GameBorder. That is the middle pane
JS.setCss ("#gameBorder", "background:red")


Io
02 Feb 2019, 20:27

No, you're misunderstanding what I mean by 'pane'. I mean the thing on the side that hold your inventory, show objects in the room, and show the possible exits. I want to change it, midgame, from Classic Style to Midnight Style.


The Pixie
05 Feb 2019, 09:36

The general way to do this is, as Forgewright says, like this:

JS.setCss ("#gameBorder", "background:red")

You just need to find the right ID to replace "gameBorder". Take a look at the first part of this page; it explains how you can find it yourself:
http://docs.textadventures.co.uk/quest/ui-javascript2.html



Io
06 Feb 2019, 02:29

Hmm. As much as I'd normally be up to the challenge, it feels like too much effort considering what a tiny part of the game the Pane Changing would actually be. Thanks anyhow.


K.V.
06 Feb 2019, 04:09

I know this is marked "Solved", but I thought this might help anyway:


Create a function named ApplyPanesTheme with no parameters.

Put this for the script in code view (I stole this bit of code from the InitInterface function, just for the record's sake):

if (game.panestheme = "Midnight") {
  JS.setPanes ("white", "midnightblue", "midnightblue", "skyblue")
}
if (game.panestheme = "Nature") {
  JS.setPanes ("#A1C935", "#254117", "#306754", "#A1C935", "green")
}
if (game.panestheme = "Parchment") {
  JS.setPanes ("#493D26", "#FAEBD7", "#FAEBD7", "#493D26", "#C88141")
}
if (game.panestheme = "Vanilla") {
  JS.setPanes ("black", "white")
}
if (game.panestheme = "Black") {
  JS.setPanes ("orange", "black", "black", "orange")
}
if (game.panestheme = "Blood") {
  JS.setPanes ("orange", "#800000", "#800000", "orange", "yellow")
}
if (game.panestheme = "Tranquil") {
  JS.setPanes ("midnightblue", "skyblue", "white", "midnightblue", "blue")
}

Then, you can change the theme and apply the changes during play like so:

// Changing the theme to Midnight (just a random choice)
game.panestheme = "Midnight"
ApplyPanesTheme

Forgewright
06 Feb 2019, 05:52

Oh, yea