Soandso2
Well-known member
- Joined
- Mar 13, 2023
- RedCents
- 937¢
To skill up languages, I wrote the following Lua, but it acts up in a strange way.
I added those delays, thinking the server-client would not handle the learning process if running at full speed. However, both delays only work during the first iteration of i.
Once the inner loop has finished and i becomes 2, the Lua executes at full speed, with no delays. There are no errors, Everything works as intended, except for the speed at which it runs. Any ideas why?
edit: Actually, the initial problem is not entirely accurate. This is part of the log: Look at the timestamps.
[CODE highlight="12-19"][Sat Jan 27 09:47:51 2024] You tell your party, '51 I am teaching you language 1'
[Sat Jan 27 09:47:52 2024] You tell your party, '52 I am teaching you language 1'
[Sat Jan 27 09:47:53 2024] You have become better at Elder Elvish! (51)
[Sat Jan 27 09:47:53 2024] You tell your party, '53 I am teaching you language 1'
[Sat Jan 27 09:47:54 2024] You tell your party, '54 I am teaching you language 1'
[Sat Jan 27 09:47:55 2024] You tell your party, '55 I am teaching you language 1'
[Sat Jan 27 09:47:56 2024] You have become better at Elder Elvish! (52)
[Sat Jan 27 09:47:56 2024] You tell your party, '56 I am teaching you language 1'
[Sat Jan 27 09:47:57 2024] You tell your party, '57 I am teaching you language 1'
[Sat Jan 27 09:47:58 2024] You tell your party, '58 I am teaching you language 1'
[Sat Jan 27 09:47:59 2024] You tell your party, '59 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '60 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '61 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '62 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '63 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '64 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '65 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '66 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '67 I am teaching you language 1'[/CODE]
Lua:
mq = require('mq')
for i=1,4,1 do
mq.cmd("/language "..i)
print("Setting language to idx "..i)
mq.delay(1000)
for l=1,100,1 do
mq.cmd("/g "..l.." I am teaching you language "..i)
mq.delay(1000)
end
end
I added those delays, thinking the server-client would not handle the learning process if running at full speed. However, both delays only work during the first iteration of i.
Once the inner loop has finished and i becomes 2, the Lua executes at full speed, with no delays. There are no errors, Everything works as intended, except for the speed at which it runs. Any ideas why?
edit: Actually, the initial problem is not entirely accurate. This is part of the log: Look at the timestamps.
[CODE highlight="12-19"][Sat Jan 27 09:47:51 2024] You tell your party, '51 I am teaching you language 1'
[Sat Jan 27 09:47:52 2024] You tell your party, '52 I am teaching you language 1'
[Sat Jan 27 09:47:53 2024] You have become better at Elder Elvish! (51)
[Sat Jan 27 09:47:53 2024] You tell your party, '53 I am teaching you language 1'
[Sat Jan 27 09:47:54 2024] You tell your party, '54 I am teaching you language 1'
[Sat Jan 27 09:47:55 2024] You tell your party, '55 I am teaching you language 1'
[Sat Jan 27 09:47:56 2024] You have become better at Elder Elvish! (52)
[Sat Jan 27 09:47:56 2024] You tell your party, '56 I am teaching you language 1'
[Sat Jan 27 09:47:57 2024] You tell your party, '57 I am teaching you language 1'
[Sat Jan 27 09:47:58 2024] You tell your party, '58 I am teaching you language 1'
[Sat Jan 27 09:47:59 2024] You tell your party, '59 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '60 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '61 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '62 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '63 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '64 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '65 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '66 I am teaching you language 1'
[Sat Jan 27 09:48:00 2024] You tell your party, '67 I am teaching you language 1'[/CODE]


Kinda cool, my first time. LOL