Skip to content

Commit 8e94335

Browse files
committed
update
1 parent 5c2e035 commit 8e94335

File tree

3 files changed

+36
-23
lines changed

3 files changed

+36
-23
lines changed

script/config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ maxstep=15
4242
stepmaxstep=15
4343
--多步搜索的最大步数,0为不多步
4444

45-
walkecho=false
45+
walkecho=true
4646
--是否回显命令
4747

4848
mudsettings="set no_more;unset prompt;set auto_drinkout;set combatd self;set auto_regenerate;set wimpy 25;unset map_prompt"

script/mods/queue.lua

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ queue={
33
tick=2100,
44
timestamp=0,
55
sent={},
6-
sep={},
76
}
87

9-
queue.exec=function(cmds)
8+
queue.exec=function(cmds,grouped)
109
queue.append(cmds)
1110
queue.send()
1211
end
@@ -16,9 +15,13 @@ end
1615
queue.discard=function()
1716
queue.queue={}
1817
end
19-
queue.append=function(cmds)
20-
for k,v in pairs(cmds) do
21-
table.insert(queue.queue,v)
18+
queue.append=function(cmds,grouped)
19+
if grouped then
20+
table.insert(queue.queue,cmds)
21+
else
22+
for k,v in pairs(cmds) do
23+
table.insert(queue.queue,{v})
24+
end
2225
end
2326
end
2427
queue.sort=function(fisrt,second)
@@ -30,7 +33,7 @@ queue.full=function()
3033
table.insert(queue.sent,ts)
3134
end
3235
end
33-
queue.send=function()
36+
queue.clean=function()
3437
local ts=Milliseconds()
3538
table.sort(queue.sent,queue.sort)
3639
local newsent={}
@@ -40,14 +43,21 @@ queue.send=function()
4043
end
4144
end
4245
queue.sent=newsent
46+
end
47+
queue.send=function()
48+
queue.clean()
4349
while #queue.queue~=0 and #queue.sent<queue.limit() do
44-
local cmd=table.remove(queue.queue,1)
45-
local ts=Milliseconds()
46-
table.insert(queue.sent,ts)
47-
SendNoEcho(cmd)
48-
if queue.sep[cmd] then
50+
local cmds=queue.queue[1]
51+
if queue.limit()-#queue.sent<#cmds then
4952
queue.full()
50-
return
53+
return
54+
end
55+
table.remove(queue.queue,1)
56+
for k,v in pairs(cmds) do
57+
local ts=Milliseconds()
58+
table.insert(queue.sent,ts)
59+
SendNoEcho(v)
60+
if walkecho==true then Note(v) end
5161
end
5262
end
5363
end

script/mods/system.mod

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ discon=function()
130130
end
131131

132132
catch=function(trigrp,command)
133-
trigrpon(trigrp)
134-
run(command)
135-
trigrpoff(trigrp)
133+
run(trigrponcmd(trigrp)..";"..command..";"..trigrpoffcmd(trigrp),true)
136134
end
137135
busytestdelay=1
138136
busytestcmd="enchase bao"
@@ -162,13 +160,20 @@ system_trigrpoff=function(name, line, wildcards)
162160
end
163161

164162
trigrpoff=function(str)
165-
run("set no_more trigrpoff "..str)
163+
run(trigrpoffcmd(str))
164+
end
165+
trigrpoffcmd=function(str)
166+
return("set no_more trigrpoff "..str)
166167
end
167168
system_trigrpon=function(name, line, wildcards)
168169
EnableTriggerGroup(wildcards[2],true)
169170
end
170171
trigrpon=function(str)
171-
run("set no_more trigrpon "..str)
172+
run(trigrponcmd(str))
173+
end
174+
175+
trigrponcmd=function(str)
176+
return "set no_more trigrpon "..str
172177
end
173178

174179
system_isbusy=function(name, line, wildcards)
@@ -203,7 +208,7 @@ end
203208

204209
_stop=false
205210
runre=rex.new("([^;*\\\\]+)")
206-
run=function(str)
211+
run=function(str,grouped)
207212
ResetTimer("on_steptimeout")
208213
if ((str=="")or(str==nil)) then return end
209214
--SetSpeedWalkDelay(math.floor(1000/cmd_limit))
@@ -217,13 +222,11 @@ run=function(str)
217222
for i, cmd in pairs (_cmds) do
218223
if cmd=="#gift" then
219224
if chatroom~=nil then
220-
cmd="enter "..chatroom
225+
_cmds[i]="enter "..chatroom
221226
end
222227
end
223-
queue.exec({cmd})
224-
--Queue(cmd,false)
225-
if walkecho==true then Note(cmd) end
226228
end
229+
queue.exec(_cmds,grouped)
227230
end
228231

229232
_nums={}

0 commit comments

Comments
 (0)