callumbagshaw
07-06-2016, 12:55 PM
Hi all,
I'm very rusty with Lua... i've been out of the loop for 3 or 4 years now - I couldn've probably written this in my sleep back then but i've forgotten 95% of the syntax lol...
Anyway..
I need a module which is a switch (or select case) on the type of attack. All it needs to do is attack with different types of runes depending which type has been set in a publisher module. Credit & thanks to Adrax13 for this piece of code.
attackType = ""
local subscriber = IpcSubscriberSocket.New("Targeting-Example", 30120)
subscriber:AddTopic("Target")
subscriber:AddTopic("Attack")
Module.New('Message Scanner', function(Mod)
local hasMessage, topic, data = subscriber:Recv()
if (hasMessage) then
if topic == "Target" then
Creature(tonumber(data)):Attack()
elseif topic == "Attack" and data == "sd" then
attackType = "SD"
elseif topic == "Attack" and data == "ava" then
attackType = "Ava"
end
end
end)
I just need something that says if attacktype = ava then use avalanche rune on target, if sd use sd on target etc..
Any help is better than no help at all!
thanks!
I'm very rusty with Lua... i've been out of the loop for 3 or 4 years now - I couldn've probably written this in my sleep back then but i've forgotten 95% of the syntax lol...
Anyway..
I need a module which is a switch (or select case) on the type of attack. All it needs to do is attack with different types of runes depending which type has been set in a publisher module. Credit & thanks to Adrax13 for this piece of code.
attackType = ""
local subscriber = IpcSubscriberSocket.New("Targeting-Example", 30120)
subscriber:AddTopic("Target")
subscriber:AddTopic("Attack")
Module.New('Message Scanner', function(Mod)
local hasMessage, topic, data = subscriber:Recv()
if (hasMessage) then
if topic == "Target" then
Creature(tonumber(data)):Attack()
elseif topic == "Attack" and data == "sd" then
attackType = "SD"
elseif topic == "Attack" and data == "ava" then
attackType = "Ava"
end
end
end)
I just need something that says if attacktype = ava then use avalanche rune on target, if sd use sd on target etc..
Any help is better than no help at all!
thanks!