-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1254 from nemurimasu/master
LSL support
- Loading branch information
Showing
5 changed files
with
657 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
//////////////////////////////////////////////////////////////////// | ||
// | ||
// AbcText | ||
// by Ange Capalini | ||
// Originally Written 10/31/2011 | ||
// code released to the public domain | ||
// | ||
//////////////////////////////////////////////////////////////////// | ||
|
||
|
||
//================================================================== | ||
// INSTRUCTIONS | ||
//================================================================== | ||
// | ||
// - set Max Particles to 4096 | ||
// - create white cube "board" <15.500, 0.010, 0.800> | ||
// - create red cube "cursor" <0.050, 0.010, 0.030> & drop AbcText | ||
// - link cursor (child) to board (root) | ||
// - send message <= 25 char. to chanel 20 | ||
// - that's all folk's | ||
// | ||
///////////////////////////////////////////////////////////////////// | ||
|
||
|
||
//=========================================== | ||
// CONSTANTS | ||
//=========================================== | ||
float Size_Point = 0.1; //pixel size | ||
string Txt_Point = ""; //pixel texture | ||
vector Color_Point = < 0., 0., 1. >; //pixel color | ||
vector Size_Affich = <15.5, .01, .8>; //display size | ||
|
||
//=========================================== | ||
// GLOBALS VARIABLES | ||
//=========================================== | ||
list Alphabet = [ " ", | ||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", | ||
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", | ||
|
||
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", | ||
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", | ||
|
||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", | ||
|
||
":", "'", ",", "!", "?", "#", ".", "/", "-", "é", "è", "à" ]; | ||
|
||
//char matrix 6 x 5 points | ||
list Matrices = [ " ", | ||
"011001001010010111101001000000", //A | ||
"111001001011100100101110000000", | ||
"011001000010000100000110000000", | ||
"111001001010010100101110000000", | ||
"111001000011100100001110000000", | ||
"111001000011100100001000000000", | ||
"011101000010110100100111000000", | ||
"100101001011110100101001000000", | ||
"111000100001000010001110000000", | ||
"001100001000010100100110000000", | ||
"100101010011000101001001000000", | ||
"100001000010000100001110000000", | ||
"100011101110101100011000100000", | ||
"100101101010110100101001000000", | ||
"011001001010010100100110000000", | ||
"111001001010010111001000000000", | ||
"011001001010010100100110000010", | ||
"111001001010010111001001000000", | ||
"011101000001100000101110000000", | ||
"111000100001000010000100000000", | ||
"100101001010010100100110000000", | ||
"100101001010100101000100000000", | ||
"100011010110101101010101000000", | ||
"100101001001100100101001000000", | ||
"100101001001110000100110000000", | ||
"111100001001100100001111000000", //Z | ||
|
||
"000000110010010100100111000000", //a | ||
"100001110010010100101110000000", | ||
"000000110010000100000110000000", | ||
"000100111010010100100111000000", | ||
"000000111010010101000111000000", | ||
"011001000011000100001000000000", | ||
"011001001010010011100001001100", | ||
"100001110010010100101001000000", | ||
"100000000010000100001000000000", | ||
"001000000000100001000010011000", | ||
"100001001010100110101001000000", | ||
"100001000010000100001000000000", | ||
"000001101010101101011010100000", | ||
"000001110010010100101001000000", | ||
"000000110010010100100110000000", | ||
"111001001010010111001000010000", | ||
"011101001010010011100001000010", | ||
"000001010011000100001000000000", | ||
"000000111011000001101110000000", | ||
"010001110001000010000100000000", | ||
"000001001010010100100111000000", | ||
"000001001010010100100110000000", | ||
"000001010110101101010101000000", | ||
"000001001001100011001001000000", | ||
"100101001010010011100001001100", | ||
"000001111000100010001111000000", //z | ||
|
||
"011001001010010100100110000000", //0 | ||
"011000010000100001000010000000", | ||
"111000001001100100001111000000", | ||
"111000001001100000101110000000", | ||
"001000110010100111100010000000", | ||
"111101000011100000101110000000", | ||
"011001000011100100100110000000", | ||
"111100001000100010000100000000", | ||
"011001001001100100100110000000", | ||
"011001001001110000100110000000", //9 | ||
|
||
"000000000000100000000010000000", //: | ||
"000100010000000000000000000000", | ||
"000000000000000000100010000000", | ||
"001000010000100000000010000000", | ||
"001000101000010001000000000100", | ||
"010101111101010111110101000000", | ||
"000000000000000000000010000000", | ||
"000010001000100010001000000000", | ||
"000000000001110000000000000000", | ||
"000100110010010101000111000000", | ||
"010000111010010101000111000000", | ||
"010000110010010100100111000000" //à | ||
]; | ||
|
||
list Particle_Parameters=[]; | ||
vector Origine; | ||
string Texte; | ||
integer id_Phrase; | ||
integer len_Phrase; | ||
integer id_Lettre; | ||
string Lettre; | ||
string matrice_Lettre; | ||
vector point_zero; | ||
integer x; | ||
integer z; | ||
|
||
//=========================================== | ||
// SET PARTICLES | ||
//=========================================== | ||
|
||
init_particles(){ | ||
|
||
Particle_Parameters = [ | ||
PSYS_SRC_TEXTURE, Txt_Point, | ||
PSYS_PART_START_SCALE, < Size_Point, Size_Point, FALSE >, | ||
PSYS_PART_END_SCALE, < Size_Point, Size_Point, FALSE >, | ||
PSYS_PART_START_COLOR, Color_Point, | ||
PSYS_PART_END_COLOR, Color_Point, | ||
|
||
PSYS_SRC_BURST_PART_COUNT, (integer)1, | ||
PSYS_SRC_BURST_RATE, (float) 0.0, | ||
PSYS_PART_MAX_AGE, (float) 30.0, | ||
|
||
PSYS_SRC_PATTERN, (integer) 1, | ||
|
||
PSYS_PART_FLAGS, | ||
PSYS_PART_EMISSIVE_MASK | ||
]; | ||
} | ||
|
||
//=========================================== | ||
// SET DISPLAY | ||
//=========================================== | ||
affichage (string phrase) { | ||
|
||
integer len_Phrase = llStringLength(phrase)-1; | ||
for(id_Phrase = 0; id_Phrase <= len_Phrase;++id_Phrase){ | ||
Lettre = llGetSubString(phrase, id_Phrase, id_Phrase); | ||
id_Lettre = llListFindList(Alphabet, [Lettre]); | ||
matrice_Lettre = llList2String(Matrices, id_Lettre); | ||
z=0; | ||
do{ | ||
x=0; | ||
do{ | ||
if( (integer)llGetSubString(matrice_Lettre, x + 5*z, x + 5*z) ) { | ||
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, point_zero + < x*Size_Point, 0.0, -z*Size_Point > ]); | ||
llParticleSystem( Particle_Parameters ); | ||
llSleep(0.12); | ||
llParticleSystem( [] ); | ||
} | ||
} while( ++x <= 4); | ||
} while( ++z <= 5); | ||
|
||
point_zero += < 6. * Size_Point, 0.0, 0.0 >; //locate next char | ||
} | ||
} | ||
///////////////////////////////////// | ||
///////////////////////////////////// | ||
///////////////////////////////////// | ||
///////////////////////////////////// | ||
|
||
|
||
default { | ||
|
||
state_entry() { | ||
|
||
llListen(20, "", llGetOwner(), ""); | ||
init_particles(); | ||
Origine = < (-0.48 * Size_Affich.x) , (-1.25 * Size_Point) , (0.3 * Size_Affich.z) >; //raz cursor | ||
} | ||
|
||
listen( integer channel, string name, key id, string msg ) { | ||
|
||
Texte = msg; | ||
point_zero = Origine; //raz cursor | ||
llSetTimerEvent(30.); | ||
affichage(Texte); | ||
} | ||
|
||
timer(){ | ||
|
||
point_zero = Origine; //raz cursor | ||
affichage(Texte); | ||
} | ||
|
||
on_rez(integer param) {llResetScript();} | ||
changed(integer mask) {if(mask & CHANGED_OWNER) {llResetScript();}} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* ***** BEGIN LICENSE BLOCK ***** | ||
* Distributed under the BSD license: | ||
* | ||
* Copyright (c) 2010, Ajax.org B.V. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of Ajax.org B.V. nor the | ||
* names of its contributors may be used to endorse or promote products | ||
* derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY | ||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* ***** END LICENSE BLOCK ***** */ | ||
|
||
define(function(require, exports, module) { | ||
"use strict"; | ||
|
||
var oop = require("../lib/oop"); | ||
var TextMode = require("./text").Mode; | ||
var Tokenizer = require("../tokenizer").Tokenizer; | ||
var lslHighlightRules = require("./lsl_highlight_rules").lslHighlightRules; | ||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; | ||
var Range = require("../range").Range; | ||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; | ||
var CStyleFoldMode = require("./folding/cstyle").FoldMode; | ||
|
||
var Mode = function() { | ||
this.$tokenizer = new Tokenizer(new lslHighlightRules().getRules()); | ||
this.$outdent = new MatchingBraceOutdent(); | ||
this.$behaviour = new CstyleBehaviour(); | ||
this.foldingRules = new CStyleFoldMode(); | ||
}; | ||
oop.inherits(Mode, TextMode); | ||
|
||
(function() { | ||
|
||
this.toggleCommentLines = function(state, doc, startRow, endRow) { | ||
var outdent = true; | ||
var re = /^(\s*)\/\//; | ||
|
||
for (var i=startRow; i<= endRow; i++) { | ||
if (!re.test(doc.getLine(i))) { | ||
outdent = false; | ||
break; | ||
} | ||
} | ||
|
||
if (outdent) { | ||
var deleteRange = new Range(0, 0, 0, 0); | ||
for (var i=startRow; i<= endRow; i++) | ||
{ | ||
var line = doc.getLine(i); | ||
var m = line.match(re); | ||
deleteRange.start.row = i; | ||
deleteRange.end.row = i; | ||
deleteRange.end.column = m[0].length; | ||
doc.replace(deleteRange, m[1]); | ||
} | ||
} | ||
else { | ||
doc.indentRows(startRow, endRow, "//"); | ||
} | ||
}; | ||
|
||
this.getNextLineIndent = function(state, line, tab) { | ||
var indent = this.$getIndent(line); | ||
|
||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state); | ||
var tokens = tokenizedLine.tokens; | ||
var endState = tokenizedLine.state; | ||
|
||
if (tokens.length && tokens[tokens.length-1].type == "comment") { | ||
return indent; | ||
} | ||
|
||
if (state == "start") { | ||
var match = line.match(/^.*[\{\(\[]\s*$/); | ||
if (match) { | ||
indent += tab; | ||
} | ||
} | ||
|
||
return indent; | ||
}; | ||
|
||
this.checkOutdent = function(state, line, input) { | ||
return this.$outdent.checkOutdent(line, input); | ||
}; | ||
|
||
this.autoOutdent = function(state, doc, row) { | ||
this.$outdent.autoOutdent(doc, row); | ||
}; | ||
|
||
}).call(Mode.prototype); | ||
|
||
exports.Mode = Mode; | ||
}); |
Oops, something went wrong.