Sarah {aka SarahCB1208} (sarahcb1208) wrote in component_help,
Sarah {aka SarahCB1208}
sarahcb1208
component_help

Trying to do smilies in posts

I've got this code:
layerinfo "type" = "theme";
layerinfo "name" = "Prettyness";

function Page::print_custom_head() {
"""

""";
}

# --------------------------------------------------
# from lj:mageboltrat's industrial nippon (id=533012)
# http://www.livejournal.com/community/s2layers/11106.html
# --------------------------------------------------
function replace_text(string text, string find, string replacement) : string
"Search within \$text and replaces any occurences of \$find with \$replacement."
{
var string[] findarray;
var int pos = 1;
foreach var string findcharacter($key) {
$findarray[$pos] = $findcharacter;
$pos = $pos + 1;
}
var int place = 1;
var bool found = false;
var string completedtext = "";
var string foundtext = "";
foreach var string searchcharacter($text) {
if ($searchcharacter == $findarray[$place]) {
if ($place == $key->length()) {
$foundtext = $value;
$place = 1;
} else {
$foundtext = $foundtext + $searchcharacter;
$place = $place + 1;
}
} else {
$completedtext = $completedtext + $foundtext + $searchcharacter;
$foundtext = "";
$place = 1;
}
}
$completedtext = $completedtext + $foundtext;
return $completedtext;
}

function get_emoticons() : string{}
"Returns an array of emoticons"
{
var string{} emoticons =
{
# for each smiley you want to add, add a new line
# the format for adding new smilies should be something like this:
# ":smiley:" => """""",
# note: for each line, there should be a comma at the very end, EXCEPT for the last line
":)" => """""",
";)" => """""",
":(" => """""",
":)" => """""",
";)" => """""",
":(" => """""",
":)" => """""",
";)" => """""",
":(" => """""",
":)" => """""",
";)" => """""",
":(" => """""",
};
return $emoticons;
}

function alter_entry(string original) : string
"Alter text by find/replace"
{

var string temp = $original;
var string value;

var string{} emoticons = get_emoticons();

foreach var string key ($emoticons) {
$value = $emoticons{$key};
$temp = replace_text($temp, $key, $value);
}

return $temp;

}


function print_free_text(Page p) {

print_comp_header($*free_text_text);
"""$*free_text""";
print_comp_footer();

print_comp_header("My Character, Trinity Leigh");
"""

Trinity Leigh is my first character at AEA

""";
print_comp_footer();

print_comp_header("Current to-do list");
"""

1. Sister Gifties (they're long overdue)

2. Festara shop order

3. FallenEID shop order

4. Bad Crystal shop order

5. Pixelcows shop order

6. September shop order

7. Fairyscape av

8. Studio 57 challenge

9. 1910 challenges @ PU

10. Vilalainess challenge

11. Bad hair day mommy challenge

12. Backgrounds for PU (donator exclusives)

13. Purple is the color of the month (PU)

14. Cause/Harmony theme at PU

15. Oyye Vey pirate for FF (auction) -- started and liking

16. Tutorials for PU (donator exclusives)

--a. How To Use The Tools (PS 7)

--b. Hair - Different styles -- Photoshop 7

--c. Jeans --Photoshop 7--

--d. Double Buns --Photoshop 7--

17. Get to work on shop stuff

18. Me, as part of the space mission -- I'm so gonna get Lissa back for that --

19. Gift for nursieKirsten

""";
print_comp_footer();

print_comp_header("Currently Working On:");
"""


#15 on my list

""";
print_comp_footer();

print_comp_header("Currents");
"""

Book: Revelations by Janice Kay Johnson

Base of Choice: Jade, by Crystal

Site of Choice: -Still working on that-

Forum of Choice: Toss-up between PU and Doll Safari

""";
print_comp_footer();

print_comp_header("Ideas");
"""

Hey, loverly people!! Wanna help me out? Send me some ideas for pixelated backgrounds. They're going to be PU exclusives, but I'll try and get some for everyone my site!!



Thank you to everyone who responds!!

""";
print_comp_footer();


print_comp_header("Lyrics to Sara, my fav song:");
"""

Go now don't look back we've drawn the line
move on it's no good to go back in time


I'll never find another girl like you, for happy endings it takes two
we're fire and ice, the dream won't come true

Sara, Sara, storms are brewin' in your eyes
Sara, Sara, no time is a good time for goodbyes

danger, in the game when the stakes are high
branded, my heart was branded while my senses stood by

I'll never find another girl like you, for happy endings it takes two
we're fire and ice, the dream won't come true

Sara, Sara, storms are brewin' in your eyes
Sara, Sara, no time is a good time oh

Sara, Sara, storms are brewin' in your eyes
Sara, Sara, no time is a good time for goodbyes

('cause Sara) loved me, like no one ever loved me before
(and Sara) hurt me, no one could ever hurt me more

(and Sara) Sara
(and Sara) nobody loved me anymore

I'll never find another girl like you
we're fire and ice, the dream won't come true

Sara, Sara, no time is a good time oh
Sara, Sara, storms are brewin' in your eyes

Sara, Sara, no time is a good time for goodbyes
Sara, Sara, storms are brewing in your eyes

Sara, Sara, no time is a good time, no
oh Sara, why did it, why did it, why did it all fall apart

""";
print_comp_footer();
}

I'm getting this error:
2 Compiler Output at Sat Jul 30 08:42:48 2005

Error compiling layer:
Compile error: line 16, column 69: Unexpected token found.  Expecting: [TokenPunct] = {
Got: [TokenPunct] = ::
  S2::Node, S2/Node.pm, 139
  S2::NodeStmtBlock, S2/NodeStmtBlock.pm, 26
  S2::NodeFunction, S2/NodeFunction.pm, 104
  S2::Layer, S2/Layer.pm, 58
  S2::Compiler, S2/Compiler.pm, 27
  
Context
 12: # --------------------------------------------------
 13: # from lj:mageboltrat's industrial nippon (id=533012)
 14: # http://www.livejournal.com/community/s2layers/11106.html
 15: # --------------------------------------------------
 16: function Replace_text(string text, string find, string replacement) :: string 
 17: "Search within \$text and replaces any occurences of \$find with \$replacement."
 18: {
 19:         var string[] findarray;
 20:         var int pos = 1;


How do I fix it? I copied and pasted exactly as it said :(
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 4 comments