Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Need Help... Global Background On/Off?

8 years ago

Ok so apparently, stalking the forums for help wasn't working for this particular feature, so I'm asking directly.

How do you make a background appear on all of the pages but turn it off or switch it to another one at will?

Something like:

IF %SHOW > 0 THEN

BEGIN

IF %SHOW = 1 THEN [display this background]

IF %SHOW = 2 THEN [display THIS background]

etc. etc. etc.

ELSE

[display this background]

 

Is this possible? I'm really messy with scripting so the above example is just comprised of knowledge of what I've seen so far, but if you can figure out what I mean can it be done and how? Thanks BTW.

-Holly

Need Help... Global Background On/Off?

8 years ago

That's the right idea, although if you're testing for exact values, you don't need to test if %SHOW is greater than zero. You can set an image as a background by using code like this: $PAGETEXT := "<style>body{background: url('HTTP');}</style>" + $PAGETEXT, replacing the HTTP with the actual address of the image. You can also test for specific pages, using something like: IF $PAGEID = 1 THEN.

Need Help... Global Background On/Off?

8 years ago
$PAGETEXT := "[body background='URL']" + $PAGETEXT

Is what you're looking for after THEN, with URL replaced by the location of the image.

Use >< brackets instead of ][

Need Help... Global Background On/Off?

8 years ago

thanks guys! just one thing:

how exactly do I get the URL for an image I have in my pictures? I try dragging it up to create an image window but it keeps downloading it with a string of numbers as the title? So confuse... help!

Need Help... Global Background On/Off?

8 years ago

ok I've got something like this:

 

$PAGETEXT := "<body background='http://chooseyourstory.com/resources/images/user/37759?37759'>" + $PAGETEXT

with 37759 being the string of numbers I mentioned earlier (did some stalking and I think this is how it should be maybe?)?

I hit validate and everything seems alright, but when I go to test the background it doesn't show up! I'm on the right page in the preview thing-a-ma-jig but the background that SHOULD be on that page isn't there. It's just white! Help me please!

Need Help... Global Background On/Off?

8 years ago

I don't think this method works anymore, at least for some devices.

Need Help... Global Background On/Off?

8 years ago

oh, well how do I MAKE it work?

Also I used the same URL for the (mega-long) coding to change the border of the inventory box (learned it from stalking >:D) and it worked perfectly. So I don't think it's the URL......

Need Help... Global Background On/Off?

8 years ago

See if <style>body{background: url('http://chooseyourstory.com/resources/images/user/37759?37759');}</style> works.

Need Help... Global Background On/Off?

8 years ago
$PAGETEXT := "<html><style>body {background: url(xxx) ;}</style> </html>" + $PAGETEXT

^ For future reference, that's the global page background script that works always. Replace xxx with the image url.

To use: Storygame Properties -> scripts -> edit global page -> paste script -> save script

Need Help... Global Background On/Off?

8 years ago
You don't need the html part, but yeah, that does work (provided the url is within ' single quotes).

$PAGETEXT := "[style]body{background: url('http://chooseyourstory.com/resources/images/user/37759');}[/style]" + $PAGETEXT

With >< instead of ][ works. No idea why the old version doesn't work anymore though.

Keep in mind this repeats the image however many times it requires to fill up the page, not just once.

Need Help... Global Background On/Off?

8 years ago

How do I stretch it to fit the entire page?

Need Help... Global Background On/Off?

8 years ago
Is it actually supposed to stretch the entire page, or do you just want it to show up once?

Need Help... Global Background On/Off?

8 years ago

Set as a background. So yes, stretch to fit the entire page. And also maybe set up the coding for me here? Like explain it? I got a little lost through all this! Thx.

Need Help... Global Background On/Off?

8 years ago

$PAGETEXT := "<style>body{background: url('http://chooseyourstory.com/resources/images/user/37759') center/cover;}</style>" + $PAGETEXT

What this does is insert HTML into the page that styles the body, setting its background to the image specified in the URL, centering that image, and scaling it so it covers the entire page.

Need Help... Global Background On/Off?

8 years ago

Great! Once again, you've helped a lot Bradin! And kudos to you two Killa for helping out! <3

Need Help... Global Background On/Off?

8 years ago

Little issue.... 

It stretches the image to fit the page like it's supposed to, but the very top of the image is cut off and moved to the bottom... Any idea what might be going on?

Need Help... Global Background On/Off?

8 years ago

Try adding "fixed" after "center/cover". The background'll stay put even if you scroll, but it should fix that issue.

Need Help... Global Background On/Off?

8 years ago

so I just do "space" fixed "whatever is after it in the code"?

Or do I have to put another "/"?

EDIT: Ok, I tried it and it worked! Thanks to you all for helping! :D

Need Help... Global Background On/Off?

8 years ago
:o thanks BD I'm a bit rough when it comes to css - but I feel like I'm learning through experience which is the best way to learn.

Need Help... Global Background On/Off?

8 years ago

I agree. That and W3Schools.

Need Help... Global Background On/Off?

8 years ago
W3Schools is alright if you know what you're doing, but their descriptions on how to use certain elements could use a bit more work. It's more of a dictionary for those who already know what they want, they just forgot what it was called - not really for people who don't know what to do.

Need Help... Global Background On/Off?

8 years ago

Ah... It is better as a reference. General web searches, though, can take you a long way.

Need Help... Global Background On/Off?

8 years ago
Get that plug-in for Firefox that lets you edit css on the page in real-time. You will learn a lot fast.

Need Help... Global Background On/Off?

8 years ago

Technology is incredible! Nowadays, you don't even need a plugin!