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
HTTP SL_Haiku_Master  

SL_Haiku_Master

PHP Script

Category: HTTP
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for SL_Haiku_Master
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. SL_Haiku_Master_1.lsl
Get file # 2. SL_Haiku_Master_2.lsl
1 <?php
2
3 // Even items are words. Odd items represent the number of syllables.
4
5 $nouns = array("griefer","2","flying car","3","camping chair","3","flexible prim","4","prim", "1", "welcome center","4", "orient island","5","Linden Lab", "3", "Linden","2", "inner core", "3", "pose ball", "5", "avatar", "3", "sim", "1", "script", "1", "hardware lighting", "4"); // Set the variable $nouns to words and syllables.
6
7 $verbs = array("Lagging","2","Flying", "2", "Building together","5","Teleporting", "4", "Pose balling", "3", "Editing appearance", "6"); // Set the variable $verbs to words and syllables.
8
9 $adv = array("in the Metaverse", "5", "slowly", "2", "well", "1", "in the air", "3", "very quickly", "4", "", "0", "with great speed", "3"); // Set the variable $adv to words and syllables.
10
11 $adj = array("so gorgeous","3","sexy cool","3","lonely","2","cool", "1", "electric", "3", "stunning", "2", "glowing", "3", "fetid inner", "4", "beautiful", "3", "abuzz", "2", "colourful", "3", "turquoise", "2", "", "0"); // Set the variable $adj to words and syllables.
12
13
14
15 function makehaiku1() { // When makehaiku1() is used\xC9
16
17 while(1) { // repeat indefinitely.
18
19 global $nouns, $adj; // Use the variables defined at the top.
20
21 $x = mt_rand(0, count($nouns)); // Set $x to a random number between 0 and the number of items in $nouns.
22
23 if($x % 2 == 1) { // If $x is odd\xC9
24
25 $x--; // subtract 1 from $x.
26
27 }
28
29 $y = mt_rand(0, count($adj)); // Set $y to a random number between 0 and the number of items in $adj.
30
31 if($y % 2 == 1) { // If $y is odd\xC9
32
33 $y--; // subtract 1 from $y.
34
35 }
36
37 $haiku1 = "The ".$adj[$y]." ".$nouns[$x]; // Set $haiku1 to "The (adj) (noun)." This will be used as the first line of the haiku.
38
39 if(1 + $nouns[$x+1] + $adj[$y+1] == 5) { // If there are 5 syllables in $haiku1\xC9
40
41 break; // exit the repeating.
42
43 }
44
45 }
46
47 return $haiku1; // Pass the value of $haiku1 to whatever is using makehaiku1().
48
49 }
50
51 function makehaiku2() { // When makehaiku2() is used\xC9
52
53 while(1) { // repeat indefinitely.
54
55 global $verbs, $adv; // Use the variables defined at the top.
56
57 $a = mt_rand(0, count($verbs)); // Set $a to a random number between 0 and the number of items in $verbs.
58
59 if($a % 2 == 1) { // If $a is odd\xC9
60
61 $a--; // subtract 1 from $a.
62
63 }
64
65 $z = mt_rand(0, count($adv)); // Set $z to a random number between 0 and the number of items in $verbs.
66
67 if($z % 2 == 1) { // If $z is odd\xC9
68
69 $z--; // subtract 1 from $z.
70
71 }
72
73 $haiku2 = $verbs[$a]." ".$adv[$z]; // Set $haiku2 to "(verb) (adverb)."
74
75 if($verbs[$a+1] + $adv[$z+1] == 7) { // If there are 7 syllables in $haiku2\xC9
76
77 break; // exit the repeating.
78
79 }
80
81 }
82
83 return $haiku2; // Pass the value of $haiku2 to whatever is using makehaiku2().
84
85 }
86
87 function makehaiku3() { // When makehaiku3() is used\xC9
88
89 while(1) { // repeat indefinately.
90
91 global $adj; // Use the variables defined at the top.
92
93 $y = mt_rand(1, count($adj)); // Set $y to a random number between 0 and the number of items in $adj.
94
95 if($y % 2 == 1) { // If $y is odd\xC9
96
97 $y--; // subtract 1 from $y.
98
99 }
100
101 $haiku3 = "It is ".$adj[$y]; // Set $haiku3 to "It is (adjective)."
102
103 if(2 + $adj[$y+1] == 5) { // If there are 5 syllables in $haiku3\xC9
104
105 break; // exit the repeating.
106
107 }
108
109 }
110
111 return $haiku3; // Pass the value of $haiku3 to whatever is using makehaiku3().
112
113 }
114
115 $haiku = makehaiku1()." - ".makehaiku2()." - ".makehaiku3(); // Display the first line, the second line, and the third line.
116
117 echo($haiku);
118
119 ?>

SL_Haiku_Master

LSL Script

Category: HTTP
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 default
2
3 {
4
6
7 {
8
9 llSay(0,"The haiku master is ready...");
10
11 }
12
13
14
15 touch_start(integer total_number)
16
17 {
18
19 key requestid = llHTTPRequest("http://www.simteach.com/slhaiku.php",[HTTP_METHOD,"GET"],"");
20
21 }
22
23
24
25 http_response(key request_id, integer status, list metadata, string body)
26
27 {
28
29 llSay(0,body);
30
31 }
32
33 }

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