Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Blurb Background Image

6 years ago

I searched the A.E board to see if I could find anything on how to do this, but nothing really came up. I'm wondering if it's possible to set an image as the background to the blurb of a story (the part you read before clicking 'play'; I'm not really sure what to call it).

I wouldn't have thought it's possible because there's no source code button in the 'Story Properties' section, but then again I've stumbled onto a few stories before with backgrounds images set on the whole page with the ratings/information textbox changed as well. If anyone knows how to change these as well I'd appreciate it; I want to mess about and see how it all looks. I've tried putting HTML and CSS directly into the properties page, but, as expected, that didn't work.

Blurb Background Image

6 years ago
I would guess it needs javascript, and I'm actually not sure if that works anymore.

Blurb Background Image

6 years ago
it's possible. I do believe it would be frowned upon since 3J put a semi-serious almost-all-powerful rule in place about messing with how the site looks anywhere.

http://chooseyourstory.com/story/de-milite-inprudenti like this? (made before the rule was in place, but also hasn't been taken away so it might be alright)

RTE is trash, use BTE like the real pros so you can code. AFAIK within a storygame html/css/js is fine. Outside of it, it gets iffy and more restricted the further you get from storygames. PM 3J; I'd put it off until 3J says it's alright.

An alternative is a title page within the game, which is absolutely possible. There's an article written by zikara about how to do it [Article Id 108] - however it's outdated. Take a look at it and see if you're interested. If that seems like a suitable alternative I'll rewrite the article and make a tutorial video. No JS is required to change the background of a page, only HTML or CSS is required.

also aren't you blind? am I thinking of a different person?

Blurb Background Image

6 years ago
I would assume the description page is allowed, it's tied in with editor and so part of the game. JJJ specifically broke profiles but left pages like this untouched even though they actively cause cancer, so my assumption was that js was fine for anything done in the editor.

Blurb Background Image

6 years ago
JS can turn into a security concern, I would check with 3J, BD, or I for any JS use unless you know exactly what you're doing. If 3J is available I'd check with him, if not I can understand what JS does but I can't write it very well - BD is very in-tune to the javascriptz and such so I'd say he's the pro here. Others who might know include Killa but may turn out to be as helpful as 3J in terms of activity. BD is anyone's best bet for webdev related things.

It's true that page literally gave me stage 4, but 3J might not have considered it or seen it. I'll look around my PM's and the forums to see if he mentioned anywhere that it was fine or not, I'm sure I've asked about it at some point a while back.

Blurb Background Image

6 years ago
As a side note, what the hell did this commentator do to break his recent posts list so badly?

Is it something like the way I routinely fuck up threads by forgetting a punctuation mark in a link because that's another thing that seems like it could be very annoying in the wrong hands.

Blurb Background Image

6 years ago
http://chooseyourstory.com/forums/newbie-central/message/20135#707099

His post here, where the code is inactive on the forums, was redisplayed on his profile page and the profile automatically presumed the code to work so the posts would display properly, thus effecting the rest of the page downward. Also like a few of the weirdo's around here he sets his own font and style for every post. The post in question is asking how he can make titles look good - and he applied it to his storygames which then did not include the closing tag and therefore effected the rest of the page. https://i.imgur.com/3lJTWMX.png

Blurb Background Image

6 years ago

Yeah, that was the story I saw with the background. I doubt I'll ever use a background, but if I do I'll use one more like BD's, which fits in better with the template of the site.

Blurb Background Image

6 years ago
He confessed to being a fake blindy but Mayana already lightly grilled his balls and fed them to him so it's cool now.

Blurb Background Image

6 years ago

Can confirm: balls were consumed.

Blurb Background Image

6 years ago

Yeah, though I was wondering if there was a way of just doing it in the blurb textbox. That looks more like it's the actual background of the page (which I'm also interested in finding out how to do).

What's BTE? Basic Text Editor? And can't I code with the RTE?

Actually, I was planning on having both like a greedy sod because I've painted two pieces that would both work well for a title page, but would look crap if put together. I was hoping I could stick one as the background on the blurb. I've read Zikara's article before and it seems useful. How is it outdated? Still, if there's more that can be done I'd like to know about it, and a tutorial video would be cool.

No, that came about from a poorly considered joke I had on my profile when I started off. 

Blurb Background Image

6 years ago
Give the blurb a div tag with an id then use css to change the background of it.

You can use RTE to code but it's a pain in the ass. Think of RTE as legos; sure, you can build a decent looking tower to a child - maybe even go so far as to make a very large but unstable structure with them - but to someone who can build an actual building those lego blocks are literally nothing and make most people who use them look childish.

In the case of RTE, some lego blocks don't fit together and you end up with restrictions and bugs. BTE is far greater if you plan to do any programming. If you plan to literally just write and only write plain text then the RTE is fine.

Blurb Background Image

6 years ago

Yeah... I'm kind of new to the coding game. I kind of know about <div> stuff or whatever only from trial and error and a few google searches, but I don't really know what I'm doing. Would I use something like <div style= "background-image"> and then use CSS code for putting in a background image?  thought it would be something like this:

body {
    background-image: url("URL HERE");
}

<div id = "background-image"></div> 

This doesn't actually work, so what have I done wrong here?

Blurb Background Image

6 years ago
<div id="whatever" style="background: url(http://url.png) //optional args//;"><p>BLURB BLURBBLURBBLU RBBLURBBLURBB LURBBLURBBLU RBBLURB BLU RB BLURB</p></div>

since you're only doing a couple things with css I wouldn't go as far to make the css separate. the ID on the div is really only necessary if you plan to do other things with other div's.

Alternatively, id the div and don't include the style within the tag itself. This can be a bit more confusing to beginners but you separate the css from the html by putting a style tag elsewhere and closing it, putting your css within the style tag instead and grabbing id's and such and styling it all in one place. it keeps it more organized but if you're only doing one or two things it seems like a waste unless you're preparing to do more in the future. https://i.imgur.com/2f5s7fN.png

Blurb Background Image

6 years ago
Thanks! I need to teach myself this stuff properly.

Blurb Background Image

6 years ago
the best way to learn how to program is to find something you want to do and then learn through experience. I don't recommend using online services that claim to teach you how to code. The only ones I've found to be even vaguely useful are Learn Python The Hard Way and Codecademy. Otherwise all you need is the documentation or use W3 to get some examples of code.

Blurb Background Image

6 years ago
Since you're planning to use lots of images you're pretty much going to have to disable the RTE. There's a bug where it eats them.

Blurb Background Image

6 years ago

It is pretty simple to do, but you can make things ugly quickly. I did it with this story with an intentionally light image so it fades into the background a bit without being intrusive. I just slapped some css on the properties page. With that, you can change text as well and create some other effects.

On that page, I just used html to label divs and used css inside a style tag to format them. And yes, once you head down that path, you will have the power to do just about anything you can dream up to that page, all without any js.

P.S. Yes, none of it will work with the rich text editor, as that editor specifically strips out attempts at html.

Blurb Background Image

6 years ago
Thanks for your help; I didn't know the RTE stopped you from doing this kind of stuff.

Blurb Background Image

6 years ago

Here's a tip if you ever find yourself putting a style tag in a storygame description. If you enclose its contents in an HTML comment block and surround it with a non-displaying div, you can ensure that the code won't show up in the description on your profile, like so:

<div style="display: none;">
<style><!--
.css {}
--></style>
</div>

Blurb Background Image

6 years ago
So, been looking at my profile, have you? Guess I should fix that...

Blurb Background Image

6 years ago
I'm trying to write down the code I've made; is there any way to do that without it actually running in the post? I'd like to show what I've scripted because I'm having some issues.
EDIT: Tried turning the RTE back on because I figured that would stop it running the code but my forum setup is still in the BTE style.

Blurb Background Image

6 years ago
I believe in this forum you can use pre tags, here, let me try:
Well never mind, that didn't work. I'll just wait for Bradin instead of spending an hour playing around... :)

Blurb Background Image

6 years ago
Just tried those and I got the same thing. Thanks for trying though; I'm wondering how Ford and Bradin wrote their code without it reading assuming they've got the BTE on!

Blurb Background Image

6 years ago

Use HTML entities as a way to use characters not supported by the encoding system (like "ɑ", which would normally be replaced with a "?") or prevent a character from being processed as HTML. For instance, &lt; and &gt; will render in HTML as < and >. This site allows you to automatically encode text, if there're more specific characters you need.

Blurb Background Image

6 years ago
Alright, this is what it looks like encoded (I don't know if I need the html tags etc. so I put them in just in case):

<html>
<head>
<style>
div.background {background: url(SECRET IMAGE; HANDS OFF) no-repeat;
background-size: contain;
opacity: 0.45;}

div.transbox {margin: 30px;
background-color: #ffffff;
background-position: center;
border: 2px solid black;
opacity: 0.6;}

div.transbox p {font-family:arial,helvetica,sans-serif
font-size:16px;
color: rgba(0,0,0,1);
text-align: center;
padding: 10px;
font-weight: bold;}
</style>
</head>
<body>
<div class="background">
<div class="transbox">
<p>SECRET BLURB TEXT; ALSO HANDS OFF</p>
</div>
</div>
</body>
</html>

So I trawled through some videos and w3 for a bit and decided to try to make things a bit more complex. What I'm going for is a transparent background image with a translucent textbox at the centre of the image with black text in. I thought the margin would do the former, but the textbox is shifted to the right and there's no margin at the top or bottom. The other problem is that the opacity sets the text as the same value. I looked this up and someone said the rgba thing would help, so I tried that but it didn't make the text opaque.

For my title page, I also can't seem to get the second image to centre right in the middle of the page. It's just kind of in the centre vertically but shifted left. I thought 'auto' would make it centre fully, but that hasn't worked along with putting four 'auto's in, or four '50%'s in. Here's the code for that:

$PAGETEXT := "
<head>
<style>
body {
background-color: #000000
}
#name {display: block;
margin: auto;}
ul {
list-style-type: none;
padding-left: 0;
}
</style>
</head>
<body>
<img id= 'name' src= 'SECOND IMAGE' />
</body>" + $PAGETEXT

Blurb Background Image

6 years ago
Three quick tips:

1. If you want different displays (opacity) for different sections, use different divs and don't put them inside one another.
2. If you want to get locations exact, float those divs and put them wherever the heck you want.
3. If you're not using it yet, be sure you're using something like Firefox with the css editor. That will allow you to display a page, see the css on the page, and edit it on the fly to see what effects your changes will make immediately. Then you can copy-paste your css back into your source once you've got it perfect.

Blurb Background Image

6 years ago
Thanks! Those are useful.
Okay, so I should get a separate CSS editor? I've just been writing it straight into the source so far and checking it, changing it, then rinsing and repeating. That would be way quicker if Firefox can do that so I'll start using it.

Blurb Background Image

6 years ago
In Firefox, Tools, Web Developer, Style Editor. Or Shift-F7 (sometimes). Or right-click, inspect element, then Style Editor. Do that when you're looking at your title page, and you should get the styles right there on the screen that you can change and see immediately the effects they will have. I use this all the time to make tiny adjustments and ensure everything fits where it is supposed to fit. Once you have it set, you can copy the changes you made, then go back to your source and paste away!

Blurb Background Image

6 years ago
Right so I changed the div tags like you said and it the background image disappears and leaves a line (which I think is the border). Also, the transparent box still has text of the same value. I found a video that said to use z-index values and layer two different div elements, so I tried that. The text is now opaque, but the new textbox won't go over the image.

The video used the 'top: Xpx;' thing to rectify this, but it doesn't work when I try it. Do you know what's going on with this or when I separate out the div sections like you suggested? Sorry for the hassle!

Blurb Background Image

6 years ago
Interestingly enough, the top attribute does nothing unless you've also included a position attribute as well. I'd suggest absolute, as that gives you the most control.

Blurb Background Image

6 years ago

Remember that an absolutely positioned element's position is based on the earliest ancestor that's also positioned. So if you're still having trouble, give the container element a position: relative; and the absolute element inside will align to it.

Blurb Background Image

6 years ago
html tag isn't necessary. don't newline when assigning $PAGETEXT := "codecodecode" + $PAGETEXT. Should be something like $PAGETEXT := "<style> body{background-color: #000;} #name {display: block; margin: auto;} ul{list-style-type: none; padding-left: 0;}</style><body>blahblahlbah..."

you can write css in this format to save space and time as well, but most webdevs who look at your css will think you're retarded for not using proper formatting. BD's habit really. Do also beware that if you get really advanced into CSS: different browsers take css differently. CSS is similar for firefox and chrome but it is not the same in many cases.

Blurb Background Image

6 years ago

What? Definitely newline. CYS Script is one of those languages that actually allows newlines in strings so there's less reason to minify it all unless you're overly obsessed with minor performance impact (like I used to be, tbf).

$PAGETEXT := "<style>
#name {
   display: block;
   margin: auto;
}

ul {
   list-style-type: none;
   padding-left: 0;
}
</style>" + $PAGETEXT

Blurb Background Image

6 years ago
So much scripting drama. I can't handle this!

Blurb Background Image

6 years ago
I tried to expand a script with newlines and it ended up not working until I put it back into condensed form; so I was under the presumption that newlines were a nono.

Blurb Background Image

6 years ago

Might've been a tab character in there? Strings allow any ASCII printable character—plus both line feed and carriage return newline characters—except for double quotes.

Blurb Background Image

6 years ago
double quotes would be the answer here. a lot of times I use html in the editor I assign it multiple things and thus use double quotes regularly. IIRC tab doesn't do anything in the script editor.

Blurb Background Image

6 years ago

That'll do it, and yeah, the tab key's got its own function in browsers, but it is still possible to paste a tab in there.