-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLotJTuneRandom.xml
More file actions
106 lines (83 loc) · 2.31 KB
/
LotJTuneRandom.xml
File metadata and controls
106 lines (83 loc) · 2.31 KB
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, June 07, 2023, 1:30 AM -->
<!-- MuClient version 5.06 -->
<!-- Plugin "LotJTuneRandom" generated by Plugin Wizard -->
<muclient>
<plugin
name="LotJTuneRandom"
author="Skiia"
id="7fcf1736ce8fb4cd069217eb"
language="Lua"
purpose="Generates a random number between 10 and 9999 when the command 'tune [item] random' is entered."
save_state="y"
date_written="2023-06-07 01:29:45"
requires="5.06"
version="1.0"
>
<description trim="y">
<![CDATA[
Generates a random number between 10 and 9999 when the command 'tune [comlink] random' is entered and sets the comlink.
Generates a random number between 1 and 999999 when the command 'setencryption [comlink] random' is entered, and encrypts the comlink.
]]>
</description>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Aliases -->
<aliases>
<alias
match="^tune (.*) random$"
enabled="y"
regexp="y"
sequence="100"
script="TuneRandom"
>
</alias>
<alias
match="sete[a-z]* .* random"
enabled="y"
regexp="y"
sequence="100"
script="SetEncryptionRandom"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
-- Seed the random number generator when the plugin is loaded
math.randomseed(os.time())
function TuneRandom(alias, line, wildcards)
-- Generate a random number between 10 and 9999
local randomNumber = math.random(10, 9999)
-- Send the command to the MUD with the random number replacing 'random'
Send("tune "..wildcards[1].." "..tostring(randomNumber))
end
function SetEncryptionRandom(alias, line, wildcards)
-- Generate a random number between 1 and 99999
local randomNumber = math.random(1, 99999)
-- Replace 'random' in the original command with the random number
local command = line:gsub("random", tostring(randomNumber))
-- Send the modified command to the MUD
Send(command)
end
]]>
</script>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="LotJTuneRandom:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
]]>
</script>
</muclient>