Jump to content

LSL posting tool for community.secondlife.com


Cerise1488303085
 Share

You are about to reply to a thread that has been inactive for 4723 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

http://userscripts.org/scripts/show/101223

This adds two buttons for the rich text editor (TinyMCE) on community.secondlife.com. pre blocks (like those from the insert code button) will be highlighted assuming LSL. There is also a button to remove the highlights, in case the formatting looks wrong, or the style tags make the post too large.

Right now this is an all or nothing operation, all pre blocks in the post or none will be highlighted. That could improve in the future, if I can find a nicer way into the iframe.

 

default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }
 
    touch_start(integer total_number)
    {
        llSay(0, "Touched.");
    }
}

 

 

  • Like 2
Link to comment
Share on other sites

one small typo, an extra "s" in 'link_message'

I also tweaked a bit, moved "default" and "state" from the keywords list to the function list (since those are sections in the viewer highligher, and similarly colored to functions)

nixed the 'event' keyword (was that a typo? or do we actaully have an "event" keyword and I didn't know?) and removed @ from the punctuation list, adding keyword: /^@[a-zA-Z_]\w*/ to lslTokens  and matching coloring of other in lslColors to the keyword type: *

could possibly add the "print" keyword.... it's in the LSO compiler... may not be in the mono one... but that's just geekiness =)

ETA:
* fixed mistake on my part

Link to comment
Share on other sites

Yes, event is a reserved word, it is declared in indra.y and indra.l but it has no corresponding function. It will cause a syntax error if it is used as a function or variable name.

print is parsed as a generic expression in real LSL, I threw it on the states pile because it was defined in the middle of them.

I will change event and print to use red "don't do that!" highlights like broken comments.

 

Jump targets are not really parsed the same way the SL editor highlights them. @ is a reserved word on its own, it can be followed by arbitrary whitespace, new lines and comments before the label. The SL editor uses a hacky highlight, like /^@.*/, even if the syntax is bogus. The editor also has trouble with valid syntax like

   @    foo; llOwnerSay
   ("huh?");

To make this right, I will promote "@" to a keyword, and add highlights for words that follow "@" or "jump".

I will probably do a similar thing for "state" and the special "default" case.

There are a few more little things I want to check in there too.

Link to comment
Share on other sites

 


Cerise Sorbet wrote:

Yes,
event
is a reserved word, it is declared in indra.y and indra.l but it has no corresponding function. It will cause a syntax error if it is used as a function or variable name.

print
is parsed as a generic expression in real LSL, I threw it on the states pile because it was defined in the middle of them.

I will change
event
and
print
to use red "don't do that!" highlights like broken comments.

 

Jump targets are not really parsed the same way the SL editor highlights them. @ is a reserved word on its own, it can be followed by arbitrary whitespace, new lines and comments before the label. The SL editor uses a hacky highlight, like
/^@.*/
, even if the syntax is bogus. The editor also has trouble with valid syntax like

  
@    foo; llOwnerSay

   ("huh?");

To make this right, I will promote "@" to a keyword, and add highlights for words that follow "@" or "jump"

I will probably do a similiar thing for "state" and the special "default" case.

cool, didn't know we had an event keyword in there... or that you could break @ apart like that. I guess properly the keyword and label are separate, but I didn't think about it (missed the print keyword in the events list, sry), good stuff though

 

Link to comment
Share on other sites

Changes are uploaded today.

2011-04-17
   
special case reserved words print, event; special highlights for jump, @, default, state; typos

2011-04-16
    move decimal ints to end of list, to capture floats w/trailing period

Known problems:

The highlighter is not prepared to handle text that has been modified in the rich editor, so don't do that. If you want to edit the contents of a code block that was already pasted in:

  1. In rich text mode, press the - LSL button to remove existing highlights.
  2. Switch to the HTML tab and edit the code there. Remember to escape less than, greater than, ampersand if you add them.
  3. Switch back to the rich text tab and press + LSL

I will try to make this less painful in the future if the editor lets me. :)

Link to comment
Share on other sites

  • 4 weeks later...

Hi, there is a small update for this today. I have temporarily removed the white-space:pre hack because it does not get along with the new editor. This trouble really needs to be fixed on the site CSS.

Copying and pasting the code should still be OK even if it wraps weirdly on the forum, and I will touch up Blue Goo in a few minutes to do the right thing. Hopefully LL can follow suit with the default style sheet.

Link to comment
Share on other sites

OK, Blue Goo is updated to force no wrapping.

On Firefox, go to http://userstyles.org/styles/44855/community-secondlife-com-blue-goo-theme and it will detect if you need an upadte, and you can press the install button to copmlete it.

If you use Chrome's Stylish, the update procedure is different. Right-click on the Stylish icon in the browser toolbar, and pick Options, then press the Check for Update button.  If you are newly installing the style sheet, use the same link as for Firefox above.

stylish for Firefox is here, the Chrome version is here.

Link to comment
Share on other sites

Sorry, I'm confused.   I've updated Blue Goo in both Chrome and Firefox 4.  

 Sample scripts produced in both LSLEditor and Notepad++ look OK when I copy paste them and press the +LSL button but when I click Preview it seems (both visually and from the HTML) to take out all the tabs and carriage returns/line feeds.   And when I copy paste the results back to either editor, I just have one long line of code.

Have I missed out a crucial step somewhere?

Link to comment
Share on other sites

you also need to update the posting tool (it's a minor change from inserting the span that contains the whitspace style workaround to not inserting it)

ETA:
it does mean that others will see the code wrapped in the container... a poor decision on LL's or Lithiums part, I don't know which

Link to comment
Share on other sites

hi, it looks from the highlighting that you are using an early version of the posting script, that is the main thing you will want to update.  It should be only a matter of picking the download button as userscripts.org again, greasmonkey should overwrite the old one for you

Link to comment
Share on other sites

integer ItWorks;default{    state_entry()    {                ItWorks = (integer)llFrand(1.0);        if (ItWorks)        {            llSay(0,"Oh. I forgot that script was even there. Got it! Thanks, Cerise.");        {        else        {            llSay(0,"Nope. Still not quite there.");        }    }}

 

 ETA: WooHoo!  :smileyvery-happy:

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4723 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...