Quinara (quinara) wrote in component_help,

Variables Syntax

SOLVED - Thanks to camomiletea!

I'm missing something really stupid, and I was wondering whether anyone could see what it was.

I'm currently in the process of trying to create a skins component that is coloured so that it gives a sort of preview of the other skin (ie. have the background colour, font colour etc. of my lighter skin instead of the usual for the component). And so I thought the easiest way of doing it would be to create a variable that determined what the current colours were and then changed them accordingly. Then I could just plonk the variables in where I wanted them and wouldn't have to worry about messing around with the free text content too much.

What I've got at the moment is this:

function print_free_text(Page p){

var string skin_bgcolor = ($*comp_bgcolor       == #131510) ? "#C5A78B" : "#131510";

var string skin_fgcolor = ($*entry_fgcolor      == #C6DED9) ? "#562E14" : "#C6DED9";

var string skin_link    = ($*entry_link         == #00FFFF) ? "#50594F" : "#00FFFF";

var string skin_vlink   = ($*entry_link_visited == #FFFFFF) ? "#2E0F00" : "#FFFFFF";

etc. And the first line of it appears to compile fine - but it has a problem with the second one, saying:

Compile error: line 789, column 5: Unexpected token found.  Expecting: [TokenPunct] = (
Got: [TokenIdent] = string
  S2::Node, S2/Node.pm, 139
  S2::NodeArguments, S2/NodeArguments.pm, 25
(If anyone needs this bit, tell me. I didn't want to waste space.)
  S2::Layer, S2/Layer.pm, 58
  S2::Compiler, S2/Compiler.pm, 27


785: function print_free_text(Page p){
787: var string skin_bgcolor = ($*comp_bgcolor       == #131510) ? "#C5A78B" : "#131510";
789: var string skin_fgcolor = ($*entry_fgcolor      == #C6DED9) ? "#562E14" : "#C6DED9";
791: var string skin_link    = ($*entry_link         == #00FFFF) ? "#50594F" : "#00FFFF";
793: var string skin_vlink   = ($*entry_link_visited == #FFFFFF) ? "#2E0F00" : "#FFFFFF";

Presumably I'm missing some brackets or something somewhere, but I can't work out what it is. If anyone could help me out I'd be really grateful.

(Sorry in advance to kunzite1 if it's something so simple that it makes you cry. ;) )
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened