• When posting, please be aware that artistic nudity is still nudity and not allowed under RpNation rules. Please edit your pictures accordingly!

    Remember to credit artists when using work not your own.

Help wanting to code w/ variables!

sunshineysoul

entertainer at the house of asmodeous
Roleplay Availability
Roleplay Type(s)
hi friends
i am finally biting the bullet and making an attempt to learn coding on here! i've been making a lot of themed plot docs for various rps i'm in and i want to try and see what i can make through coding ((:
HOWEVER, as i look through tutorials and guides for bbcode, i can't find a whole lot of resources regarding using :bishiesparklesl: variables :bishiesparklesr: i've been trying to take apart and dissect different already-existing codes to try and learn what different things do but there's just so much so if anyone has any tutorials, tips and tricks about coding with variables it'd be very appreciated!
 
Long story short, you're attaching a label to a value that you plan to use frequently throughout a code whether it be a color, percentage, px measurement, etc. Ideally you'll want to specify all variables in the outermost div. They're written as "--NAMEOFVARIABLE: VALUE", and you use "var(--NAMEOFVARIABLE)" whenever you want to use the value associated with the name you specified for the variable.

For example, let's say you want to use the color #ff0000 in several places in the code. You'll write something like
Code:
[div=
--color1: #ff0000;
color: var(--color1);
]This is the color red.[/div]
Which produces
This is the color red.

If in this example you used the variable "color1" in ten spots throughout the code but end up wanting to use blue instead of red, replacing the value (i.e. #ff0000) assigned to "color1" to whatever color you want to change it to will change all ten instances that you used "color1" to the new color you assigned.
 
thank you both!!
is div essentially the same as border? or are they completely different?
 
border is just the bbcode tag used for borders, and people only used it in conjunction with css injection due to the site not having div tags for a period of time. It has some default values that are typically undesirable, so there aren't many reasons to use it over the div tag now in terms of css.
 
Gonna slide this in here for you. This site has really good ref.

Using CSS custom properties (variables)

Since BBCODE on RP Nation is just a smash of HTML and CSS together, that may be why you couldn't find info on variables.
Dm me any time if you have questions. ~
 

Users who are viewing this thread

Back
Top