Перейти к содержанию

Дайджесты за январь-февраль

Обновления гайдов и аддонов

Январь Февраль

Мониторинг серверов и редактор аддонов

Представляем вам две легенды. То, о чем можно было только мечтать, стало реальностью.

Мониторинг серверов Редактор аддонов

Подсказки из игры на вашем сайте

Теперь вы можете отображать сведения о внутриигровых элементах простым наведением курсора мыши.

Подробнее

Апдейтер аддонов

Представляем вам программу для автообновления аддонов и делимся подробностями.

Подробнее Скачать

You may send chat messages with addon's help.


Setras

Рекомендуемые сообщения

Here's a howto:

Open chat line by pressing enter, modify ChatInputText by using mission.SetChatInputText() command.

Docs say there is one parameter, but lua says the function needs two, i just use 1 as a second parameter.

Code:
mission.SetChatInputText(userMods.ToWString("Test ABC ABC test"), 1 )

And finally hit enter.

Chat script changes ChatInputText only if you modify the edit line, so if you don't change the edit line - you may change it through your addon.

So you may send any data by just fast-hitting enter twice + a button on the screen (unfortunateley binds do not work while editing edit line) or before hitting enter.

Say, for example, double click F1 for saying "I am out of mana", triple click for "Attacking left turret" and so on. Remember, setting chat input is not a crime, so you won't get any errors while selecting yourself or party members (F1-F6) without open chat line.

You also may auto change chat type (party, guild, etc):

Code:
mission.SetChatInputType( "party" )

For example add this to MainForm.(WidgetForm).xdb:

Code:
<bindSections>

<Item>

<bindSection>mission_members</bindSection>

<bindedReactions>

<Item>target_avatar</Item>

<Item>party_member_1</Item>

</bindedReactions>

</Item>

<Item>

<bindSection>mission_actions</bindSection>

<bindedReactions>

<Item>action_04</Item>

</bindedReactions>

</Item>

</bindSections>

(just an example)

And this code to your addon:

Code:
Global("PressedButtonData", {} )

PressedButtonData.Counter = 0 

PressedButtonData.LastButton = 0

PressedButtonData.ForcedText = nil

PressedButtonData.LastTime = mission.GetLocalTimeHMS()

PressedButtonData.ChatInputLastTime = mission.GetLocalTimeHMS()

function timer(params)

if params.effectType == ET_FADE and params.wtOwner:IsEqual( mainForm ) then 

mainForm:PlayFadeEffect( 1.0, 1.0, 1, EA_MONOTONOUS_INCREASE )

userMods.SendEvent( "EVENT_FRAME_TIMER", {sender = common.GetAddonName()} )

end

end

function StartTimer()

common.RegisterEventHandler( timer , "EVENT_EFFECT_FINISHED" )

mainForm:PlayFadeEffect( 1.0, 1.0, 1, EA_MONOTONOUS_INCREASE )

end

function StopTimer()

common.UnRegisterEventHandler( timer, "EVENT_EFFECT_FINISHED" )

end

function ChatInputEnforcer()

if GetTimeDifferenceInMilliseconds(PressedButtonData.ChatInputLastTime, mission.GetLocalTimeHMS()) < 3000 then

mission.SetChatInputText( PressedButtonData.ForcedText , 1 )

else

StopTimer()

end

end

common.RegisterEventHandler( ChatInputEnforcer , "EVENT_FRAME_TIMER" )

function GetTimeDifferenceInMilliseconds (a, B)

local TimeDifferenceInMilliseconds = (a.ms + 1000 * (a.s + 60 * ( a.m + 60 * a.h))) - ( b.ms + 1000 * (b.s + 60 * ( b.m + 60 * b.h)))

return(math.abs(TimeDifferenceInMilliseconds))

end

function IHavePressedF1Button( par )

if PressedButtonData.LastButton ~= 1 then PressedButtonData.LastButton = 1 PressedButtonData.Counter = 1 end

if GetTimeDifferenceInMilliseconds(PressedButtonData.LastTime, mission.GetLocalTimeHMS()) < 1000 then

PressedButtonData.Counter = PressedButtonData.Counter + 1

else

PressedButtonData.Counter = 1

end

if PressedButtonData.Counter == 1 then 

PressedButtonData.ForcedText = userMods.ToWString("/oom")

elseif PressedButtonData.Counter == 2 then 

PressedButtonData.ForcedText = userMods.ToWString("/healme")

end

PressedButtonData.ChatInputLastTime = mission.GetLocalTimeHMS()

StartTimer()

PressedButtonData.LastTime =  mission.GetLocalTimeHMS()

end

common.RegisterReactionHandler( IHavePressedF1Button, 'target_avatar' )

function IHavePressedF2Button( par )

if PressedButtonData.LastButton ~= 2 then PressedButtonData.LastButton = 2 PressedButtonData.Counter = 1 end

if GetTimeDifferenceInMilliseconds(PressedButtonData.LastTime, mission.GetLocalTimeHMS()) < 1000 then

PressedButtonData.Counter = PressedButtonData.Counter + 1

else

PressedButtonData.Counter = 1

end

if PressedButtonData.Counter == 1 then 

PressedButtonData.ForcedText = userMods.ToWString("!W00T W00T RED ALERT!")

elseif PressedButtonData.Counter == 2 then 

PressedButtonData.ForcedText = userMods.ToWString("Heal, zeny, item please!")

end

PressedButtonData.ChatInputLastTime = mission.GetLocalTimeHMS()

StartTimer()

PressedButtonData.LastTime =  mission.GetLocalTimeHMS()

end

common.RegisterReactionHandler( IHavePressedF2Button, 'party_member_1' )

And enjoy!

Ссылка на комментарий
Поделиться на другие сайты

  • 2 недели спустя...

Гребаная принцесса всех распугала. Уебищная реклама. Скиллкодеру наверно нравится Х_х

Ссылка на комментарий
Поделиться на другие сайты

Гость
Ответить в этой теме...

×   Вставлено с форматированием.   Восстановить форматирование

  Разрешено использовать не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.

×
×
  • Создать...

Важная информация

Пользуясь сайтом, вы принимаете Условия использования