Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Script name: CommandInput
- Event: sysDataSendRequest
- Code:
- pendingVenoms = pendingVenoms or {}
- venoms = venoms or {
- left = {},
- right = {}
- }
- function CommandInput(_, command)
- if string.find(command, "envenom %a+ with %a+") then
- local weapon = string.match(command, "envenom (%a+)")
- local venom = string.match(command, "with (%a+)")
- -- TODO: convert item numbers into left/right based on wielded tracking? Will the %a+ pattern work for an actual number?
- table.insert(pendingVenoms, {
- hand = weapon,
- venom = venom
- })
- end
- end
- function handlePendingVenom(venom)
- local pendingVenom = pendingVenoms[1]
- if not pendingVenom then
- return
- end
- table.remove(pendingVenoms, 1)
- if pendingVenom.venom ~= venom then
- -- something went wrong, likely stupidity or aeon caused this command to not be sent so we'll look at the next one
- -- Note: won't handle combinations with the same venom that get screwed up
- handlePendingVenom(venom)
- else
- table.insert(venoms[pendingVenom.hand], 1, pendingVenom.venom)
- end
- end
- Trigger name: Envenom
- Perl regex: ^You rub some (\w+) on .+\.$
- Line spacer: 1
- Lua function: return isPrompt()
- Multiline / AND: Yes
- Line delta: 1
- Code: handlePendingVenom(multimatches[1][2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement