Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.


The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more



Recommended Posts

We had a discuss in one of add-on's topics, but i had thought that everyone should know somevery usefull tricks you can do in AO.

So here's the first one:


Creating your own timer.

It's helpfull if you need something to renew faster or slower than each second.

An example of what it is and how it could be used is in TS3Viewer addon. It shows you who's speaking in your TS room in real time, and sometimes it happens so that you hear multiple people giving short comments and so on and renewing the window each second i not fast enough.

What you need is(isuppose you know how to create add-ons and widgets as well as basics of Lua):

A dummy widget of any size and position, even a tootally transparent 1x1 pixel one would do the job.

Let's say it's called wtKenny.

Also we need any WidgetPlayEffect, like fade effect, size or move are OK as well.

And a handler with a function that will repeatedley run that effect.

So here's a lil example of a timer using widget wtKenny and triggering each 0.25 seconds (250 milliseconds):


function timer(params)

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

    wtKenny:PlayFadeEffect( 1.0, 1.0, 250, EA_MONOTONOUS_INCREASE )

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



function MyFunctionHere(params)

--Insert your code here


function Init()

    wtKenny = mainForm:GetChildChecked( "Kenny", false )

    common.RegisterEventHandler( timer, "EVENT_EFFECT_FINISHED" )

    common.RegisterEventHandler( MyFunctionHere, "EVENT_250_MS_TIMER" )

    wtKenny:PlayFadeEffect( 1.0, 1.0, 250, EA_MONOTONOUS_INCREASE )



In this example an event called "EVENT_250_MS_TIMER" is sent to every user addon each 250 milliseconds with params.sender equal to your addon's name.


Use unique event name or perform a check to ensure that you've got an event from your timer, because otherwise you'll run functions triggered by other addons, which, for example, could make you run functions twice or even more often than expected!


Second parameter in userMods.SendEvent must be a table!


Today evening i'll edit this post and show you how to find direction to target, and maybe tomorrow evening - even a distance to target ;-)

Link to comment
Share on other sites

Yeah, job and stuff... Sleepless night and after i was working all day long, came back 30 minutes ago and i already want to sleep, sry...

But here is a LITTLE tip: Attach widget 2D and observe it's on-screen coordinates and player camera rotation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using our site you agree to the Terms of Use