-
Notifications
You must be signed in to change notification settings - Fork 33
/
NotecardMakerHUD.lsl
132 lines (110 loc) · 3 KB
/
NotecardMakerHUD.lsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
integer channel;
integer listener = -1;
string status;
list btns ;
key owner;
string cardName = "_script.scr";
string scriptText;
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) +
llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
string anim = "";
integer menuindex;
DialogPlus(key avatar, string message, list buttons, integer channel, integer CurMenu)
{
if (12 < llGetListLength(buttons))
{
list lbut = buttons;
list Nbuttons = [];
if(CurMenu == -1)
{
CurMenu = 0;
menuindex = 0;
}
if((Nbuttons = (llList2List(buttons, (CurMenu * 10), ((CurMenu * 10) + 9)) + ["<<", ">>"])) == ["<<", ">>"])
{
menuindex =0;
DialogPlus(avatar, message, lbut, channel, menuindex);
}
else
llDialog(avatar, message, order_buttons(Nbuttons), channel);
}
else
llDialog(avatar, message, order_buttons(buttons), channel);
}
showDialog()
{
btns = ["Close", "movetov", "AddCode", "Clear", "SaveCard", "Reload"];
llDialog(llGetOwner(), "Current Script: \n"+llGetSubString(scriptText, -480, -1), btns, channel);
}
startListen()
{
channel = -1 - (integer)("0x" + llGetSubString( (string) llGetOwner(), -6, -1) ) - 12313 ;
llListen(channel, "","","");
}
default
{
state_entry()
{
llSetText("Notecard Editor", <1,1,1>, 1.0);
startListen();
}
attach(key u)
{
startListen();
}
on_rez(integer n)
{
llResetScript();
}
touch_start(integer num)
{
showDialog();
status = "";
}
listen(integer chan, string who, key id, string msg)
{
if (status == "entertext")
{
scriptText = llStringTrim(scriptText, STRING_TRIM) + "\n"+msg+"\n";
status = "";
}
else if (msg == "movetov" )
{
list res = llGetObjectDetails(llGetOwner(), [OBJECT_POS]);
scriptText += "movetov " +(string)llList2Vector(res,0) + "\n";
llOwnerSay("movetov " +(string)llList2Vector(res,0) );
}
else if (msg == "AddCode")
{
llTextBox(llGetOwner(), "" +llGetSubString(scriptText, -120,-1)+ "\nAdd code:" , channel);
status = "entertext";
return;
}
else if (msg == "Clear")
{
scriptText = "";
}
else if (msg == "Reload")
{
scriptText = osGetNotecard(cardName);
}
else if (msg == "SaveCard")
{
if (llGetInventoryType(cardName)==INVENTORY_NOTECARD)
{
llRemoveInventory(cardName);
llSleep(0.25);
}
osMakeNotecard(cardName,scriptText);
llOwnerSay("Card Saved");
}
else if (msg == "Close")
{
return;
}
showDialog();
}
}