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.

More

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

How to run a String as lua sourecode or how to write a comandline for Allods


Guest Carnifex
 Share

Recommended Posts

Guest Carnifex

A few months ago, I started to write an addon, but because of a lag of time a doesn't finished it yet and I think, I will not have the time for doing this in the near future. Because of this, I will share the beginnings (I know it is in a very early state and the most work is based on icreators work for how to add messages to the chat box with little modification) and maybe someone of you can continue it...

I started to write an addon, which runs every lua code, which you write in the in-game chat box after a "/cmd" (you can find some example here), which is unfortunately the whole functionality in the current version of the addon (look at the attachement).

But the intention of the addon was, to create a single place for all gui-less addon/scrips for allods online, splitted into to types: one which register events (you can turn then on and off...) e.g. AutoSetLootScheme and one you only run once after pressing the button (e.g. invite all players in range). So developers should get a new place to write little addon directly ingame and "normal" users a place to easily manage a catalog of gui-less addons.(Í also still planned to solve the problem with the double use of global variables by replacing all of them internal with ones mapped into a table indexed with the name of the addon...). But for all of this I have not enough time atm and I think the text is long enough so here is my prototype (It's very simple atm, so only a test of the basic idea):

Edit: Ok, I see Setras had a similar idea too, but nobody had created an addon out of it, but it would be in my opinion a nice to have tool also without the peer to peer updating thing.

Link to comment
Share on other sites

Code:
Global( "ADDON_NAME", common.GetAddonName() )
common.RegisterEventHandler( function( event )
local a, b, addonname, text = string.find( userMods.FromWString( event.text ), "/script%s*(%a+) %s*(.+)" )
if addonname == ADDON_NAME then
common.LogInfo( ADDON_NAME, text )
assert( loadstring( text, "runtime call" ) )()
end
end, "EVENT_UNKNOWN_SLASH_COMMAND" )


Usage: type in chat line: "/script *AddonName* *code*"

Example:
Code:
/script MyAddon common.LogInfo( "Hello world!" )

Code:
/script MyAddon common.LogInfo( "My name is ", object.GetName( avatar.GetId() ), "." )
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.

Guest
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.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use