You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Thursday, September 13th 2012, 1:22pm

Help! Trying to buff on chat event

I'm basically trying to create a script that'll cast buffs when triggered by a chat event. I'm only passingly familiar with scripting, pretty much just proficient enough to mod other people's scripts, so I thought I'd try to modify the dAFK script. I tried to simply replace the "SendChatMessage" command on an if/then statement with a simple CastSpellByName(""); command and it doesn't seem to be working.

The full addon is here http://www.curse.com/addons/rom/dafk

I was chaging the original code here:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function dAFK.SendAutoReply(event, channel)    local whereToSend = {
        CHAT_MSG_WHISPER    = { StringTable = "Wisper",    Type = "WHISPER",    Channel = arg4,    RunCheck = function () return channel ~= nil end,    },
        CHAT_MSG_GUILD        = { StringTable = "Guild",    Type = "GUILD",        Channel = nil,    RunCheck = function () return true end,    },
        CHAT_MSG_PARTY        = { StringTable = "Party",    Type = "PARTY",        Channel = nil,    RunCheck = function () return dAFK.DNDInParty end,    },    }
    
    local messageMap = {    [1] = "AutoReplyAFK",    [2] = "AutoReplyDND",
                            [3] = "AFK",            [4] = "DND",    }
    
    local messageMapFn = function (event) 
        return ((dAFK.UserMessage == 1 and dAFK.UserMessages[messageMap[(dAFK.State + 2)]] ~= nil and dAFK.UserMessages[messageMap[(dAFK.State + 2)]] ~= "") 
            and dAFK.UserMessages[messageMap[(dAFK.State + 2)]] 
            or dAFK.Strings[whereToSend[event].StringTable][messageMap[(dAFK.State)]]); 
        end;
    
    if (whereToSend[event].RunCheck()) then
        SendChatMessage(dAFK.Strings.AutoReply.." "..messageMapFn(event), whereToSend[event].Type, 0, whereToSend[event].Channel);
    else
        PlaySoundByPath("Interface/Addons/dAFK/Sounds/Notify.wav");
    end;
end;


to

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function dAFK.SendAutoReply(event, channel)    local whereToSend = {
        CHAT_MSG_WHISPER    = { StringTable = "Wisper",    Type = "WHISPER",    Channel = arg4,    RunCheck = function () return channel ~= nil end,    },
        CHAT_MSG_GUILD        = { StringTable = "Guild",    Type = "GUILD",        Channel = nil,    RunCheck = function () return true end,    },
        CHAT_MSG_PARTY        = { StringTable = "Party",    Type = "PARTY",        Channel = nil,    RunCheck = function () return dAFK.DNDInParty end,    },    }
    
    local messageMap = {    [1] = "AutoReplyAFK",    [2] = "AutoReplyDND",
                            [3] = "AFK",            [4] = "DND",    }
    
    local messageMapFn = function (event) 
        return ((dAFK.UserMessage == 1 and dAFK.UserMessages[messageMap[(dAFK.State + 2)]] ~= nil and dAFK.UserMessages[messageMap[(dAFK.State + 2)]] ~= "") 
            and dAFK.UserMessages[messageMap[(dAFK.State + 2)]] 
            or dAFK.Strings[whereToSend[event].StringTable][messageMap[(dAFK.State)]]); 
        end;
    
    if (whereToSend[event].RunCheck()) then
        CastSpellByName("Mysterious Grace");
    else
        CastSpellByName("Mysterious Grace");
    end;
end;


The only part I've changed (and broken) is what's supposed to happen on the event trigger. Ideally instead of replying with "I'm afk" in whisper or in guild, I wanted it to simply cast the buff. Simplistic I know... but I'm not really skilled enough with code to do much better. The /afk command still triggers the "I 'm going afk" message in guild chat, but nothing happens when my toon is whispered or my toon's name is mentioned.

I'll try out different things in the meantime, but any help, tips, or a new script entirely would be greatly appreciated.
Deraan
77/77/71 M/W/R
Govinda - Bteam

RoMage

rustyx is lame rogue

Posts: 2,694

Location: web

Occupation: DB Admin

Mood: Unsure

  • Send private message

2

Thursday, September 13th 2012, 2:09pm

I believe that you should look at auto-mount script. It accepts mount request automatically, and should be easier to change to do something else automatically.

This is not bad idea, to have your own pocket healer behind you all the time, casting heal spells and buffs. :)

Is it boting - not so sure.

KatalanOrk

Intermediate

Posts: 563

Location: Nijmegen, The Netherlands

  • Send private message

3

Thursday, September 13th 2012, 3:40pm

The API was changed so you cannot activate skills through whispers afaik. It is completely 'botting' as it is controlling two characters through one interface.

This way you could have a whole party wholly under your control and that is not what the game is about (imagine a whisper triggering DIYCE on multiple characters).

RoMage

rustyx is lame rogue

Posts: 2,694

Location: web

Occupation: DB Admin

Mood: Unsure

  • Send private message

4

Thursday, September 13th 2012, 4:03pm

Someone still had to push the button, if that is what makes difference between botting and well designed macro.

How different is from me playing on 2 screens, issuing commands on both screens - add-on is just making it easier to do and takes boring part of the game out. (like clicking 'accept mount' invitation, or auto accept for group add-on - are those botting as well?)

In my opinion, it is gray area between botting and being valid use to simplify game play.

5

Thursday, September 13th 2012, 9:31pm

I really just wanted the buffing part, didn't think of a heal bot... and that wouldn't work too well for me as a mage anyway.

Anyway I'll take a look at the autoride script and see how easy that is to modify, thank you for the suggestion! Any more help would still be appreciated, I get the feeling I might run into the same problem.
Deraan
77/77/71 M/W/R
Govinda - Bteam