Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Printf Printf  

Printf

Printf

Category: Printf
By : Vince Bosen
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Printf
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Printf_1.lsl
1 //Created by: Vince
2 string format(string text, list args)
3 {
4 integer len=(args!=[]);
5 if(len==0)
6 {
7 return text;
8 }
9 else{
10 string ret=text;
11 integer i;
12 for(i=0;i<len;i++)
13 {
14 integer pos=llSubStringIndex(ret,"{"+(string)i+"}");
15 if(pos!=-1)
16 {
17 ret=llDeleteSubString(ret,pos,pos+llStringLength("{"+(string)i+"}")-1);
18 ret=llInsertString(ret,pos,llList2String(args,i));
19 }
20 else
21 {
22 return "error!!!!onetwothree";
23 }
24 }
25 return ret;
26 }
27 }
28 printf(string text, list args)
29 {
30 string texxt=format(text,args);
31 if(texxt!="error!!!!onetwothree")
32 llSay(0,texxt);
33 else
34 llSay(DEBUG_CHANNEL,"Malformed string given for printf().");
35 }
36 default{
38 {
39 printf("hello {0}!",[llKey2Name(llGetOwner())] );
40 }
41 }

Back to the Best Free Tools in Second Life and OpenSim.