Forums

New Add-on: ConfigWindow v1.3

Share your addons for the game here.

New Add-on: ConfigWindow v1.3

Postby ciuine » Fri May 27, 2011 2:33 pm

This "super" add-on is an assistant to add-on function. Similar to AddonManager. However, instead of being able to turn on/off or hide add-ons; it is capable of allowing add-on developers to quickly and simply create buttons or user input abilities for their add-ons. This allows the user and the developer to reduce the amount of memory their add-on uses if they want to allow people to customize certain aspects of the add-on.

Demonstration 1 (actual configuration buttons for NamePlateBars minus IconTabled);
Image
Seen in this image is a large list of true/false buttons, generated with a single loop of code from the owner add-on.
Also seen is a demonstration of the tabled buttons which allow the user to easily switch forward and backward through a predefined table stored in the owner add-on.

Demonstration 2 (not actual configuration buttons for NNRS);
Image
Seen in this image is a fake IconTable with no icons.
A slider button which sends an event every time the slider is moved to the owner add-on.
A color button, which can be changed based on the color sliders in the right side of the window.
Two EditLine buttons, one numeric and one string, clicking these opens and focuses on an EditLine to which the user can type in information and press enter to send the information to the owner add-on.
A true/false button.

Window accessed by typing /cw.
Download: Curse Download - ConfigWindow Read the readme.txt about .pak files.

Update v1.3:
    Updated for 3.0 UserModsService built-in add-on issues. (Fixes the bug where the add-on shows from closing the escape menu.)
    Add-on is now a .pak file.
    Included notes for add-on developers as an additional text document.

Update v1.2:
    Added a Close Button.
    Added an external force open event, "CONFIG_OPEN_EVENT_RESPONSE".
    Made the Color Sliders more intuitive aesthetically.
Last edited by ciuine on Sun Mar 25, 2012 10:05 am, edited 5 times in total.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: New Add-on: ConfigWindow v1

Postby ciuine » Fri May 27, 2011 2:43 pm

--Developer Advice--
Response to "CONFIG_INIT_EVENT" -
    Code: Select all
    userMods.SendEvent("CONFIG_INIT_EVENT_RESPONSE", { sender = common.GetAddonName() })
Response to "CONFIG_EVENT_"..common.GetAddonName() -
    Required -
      NoB - This is the number of the button to be created.
      name - This is for the name of the button.
      btnType - This is the type of button;
        "T/F" - For true and false buttons.
        "EditLine" - For user input lines.
        "Color" - For a customizable color button.
        "Slider" - For a sliding button.
        "Tabled" - For a forward/backward table button.
    Optional -
      state - This is for the "T/F" button, true or false.
      value - This is mainly for the button types "Tabled" and "EditLine" to update the value.
      steps - This is for the number of steps for the "Slider" button.
      pos - This is for the position the "Slider" button should start at.
      color - This is the RGBA current value of the color button.
      texture - This is the textureId of a texture.
      sizeX - Size for X value of "Tabled" texture.
      sizeY - Size for Y value of "Tabled" texture.
      text - Text for "Tabled" text.
      scale - Scale for "Tabled" text.
    Example -
      Code: Select all
      userMods.SendEvent("CONFIG_EVENT_RESPONSE", {NoB = 0, name = "Dance", btnType = "T/F", state = true})
Response to "CONFIG_CHANGE_BUTTON_RESPONSE" -
    Required -
      NoB - Number of the button to change text.
    Optional -
      name - Name of the button. "EditLine" or "Tabled" buttons.
      value - The new value for the button. "EditLine" or "Tabled" buttons.
      texture - The new texture. "Tabled" buttons only.
      sizeX - Size for X value of "Tabled" texture.
      text - Text for "Tabled" text.
      scale - Scale for "Tabled" text.
    Example -
      Code: Select all
      userMods.SendEvent("CONFIG_CHANGE_BUTTON_RESPONSE", {NoB = 0, name = "Dance2", value = "Tango"})
Response from "CONFIG_BUTTON_"..common.GetAddonName() -
    Values Sent - {name, state}
Response from "CONFIG_EDIT_LINE_"..common.GetAddonName() -
    Values Sent - {name, text}
Response from "CONFIG_COLOR_"..common.GetAddonName() -
    Values Sent - {name, color}
Response from "CONFIG_SLIDER_"..common.GetAddonName() -
    Values Sent - {name, pos}
Response from "CONFIG_TABLED_"..common.GetAddonName() -
    Values Sent - {name, dir} (dir is "+" or "-")

Example code for True/False buttons:
Code: Select all
--CONFIG WINDOW COOPERATION
function ConfigInitEvent()
   userMods.SendEvent("CONFIG_INIT_EVENT_RESPONSE", { sender = common.GetAddonName() })
end

function ConfigEvent()
   local num = 0
   for i, v in NPB do
      userMods.SendEvent("CONFIG_EVENT_RESPONSE", {NoB = num, name = L[GetGameLocalization()][i], btnType = "T/F", state = v})
      num = num + 1
   end
end

function ConfigButtonResponse(p)
   local s
   for i, v in L[GetGameLocalization()] do
      if v == p.name then
         s = i
      end
   end
   if NPB[s] ~= nil then
      NPB[s] = not NPB[s]
   end
   userMods.SetGlobalConfigSection("NPB", NPB)
   common.StateUnloadManagedAddon( "UserAddon/"..common.GetAddonName() )
   common.StateLoadManagedAddon( "UserAddon/"..common.GetAddonName() )
end

Code: Select all
function Init()
-- CONFIG WINDOW EVENTS (INIT, RESPONSE, BUTTON)
   common.RegisterEventHandler( ConfigInitEvent, "CONFIG_INIT_EVENT" )
   common.RegisterEventHandler( ConfigEvent, "CONFIG_EVENT_"..common.GetAddonName())
   common.RegisterEventHandler( ConfigButtonResponse, "CONFIG_BUTTON_"..common.GetAddonName())
end
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: New Add-on: ConfigWindow v1.2

Postby ciuine » Sat Oct 15, 2011 6:48 pm

Updated the add-on.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: New Add-on: ConfigWindow v1.2

Postby the_mexican_guy » Sat Oct 15, 2011 8:37 pm

Added a Close Button.

Was about time, lol
Image
Image
User avatar
the_mexican_guy
Free Trader
 
Posts: 1147
Joined: Mon Jan 19, 2009 4:37 pm

Re: New Add-on: ConfigWindow v1.2

Postby xorbs272 » Fri Oct 28, 2011 8:01 am

hey,

umm
i dont get how to run this program can you explain?
xorbs272
Citizen
 
Posts: 4
Joined: Thu Sep 29, 2011 6:14 am

Re: New Add-on: ConfigWindow v1.2

Postby ciuine » Fri Oct 28, 2011 9:57 am

You type the slash-command /cw in game.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: New Add-on: ConfigWindow v1.2

Postby gnerbal » Sat Nov 05, 2011 7:21 am

Where are the paramaters that I've changed stored? I want to reset an addon to it's default state, and I've tried deleting both folders (the addon and CW) but when I reinstall the addon, my old settings are still there.

Thanks in advance for your help!
User avatar
gnerbal
Recruit
 
Posts: 39
Joined: Wed Oct 10, 2007 9:24 am

Re: New Add-on: ConfigWindow v1.2

Postby ciuine » Sat Nov 05, 2011 10:10 am

All add-ons that store information, store that information in tables in the AllodsOnline/Personal/user.cfg text file. The name of the table will be dependent on what the developer named the table as most avoid using the actual name of the add-on because LibDnD uses the actual name of the add-on.

ConfigWindow has nothing to do with storing data, it's just an intermediary. ConfigWindow goes, "Hey add-on, the user wants to talk to you!" Add-on goes, "Fine, I don't really like them though. Here's all the things that I will talk about." ConfigWindow then says to the user, "Here's a list of things the add-on will talk about." Then when the user changes something, ConfigWindow goes "Hey add-on! The user says change this field." Then the add-on goes, "Fine! Let me run the code to change that field and I'll store the field. Here's the changed value for the list."
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: New Add-on: ConfigWindow v1.2

Postby citizenkane_ » Fri Jan 27, 2012 4:25 pm

Can we get a list of addons which use this? I really like it, and will replace similar addons with ones that use CW, if i can.
Image
Steam | Youtube | Twitch | Twitter
Citizenkane - Orc Great Brute
Ascendancy - Yul Empire
User avatar
citizenkane_
Astral Scholar
 
Posts: 4622
Joined: Sat May 01, 2010 11:50 pm

Re: New Add-on: ConfigWindow v1.2

Postby ciuine » Fri Jan 27, 2012 5:00 pm

Not many. Only my add-ons use it as far as I've seen. Icreator "shot" its usage down, because he believed that it wouldn't be useful and was working on his similar AddonTools (which started out as an "Emote" monitor and somehow adapted the "necessity" it is today), so everyone stays away from it.

PlayerHUD, NCT, DoTTimer, NamePlateBars (not NPB2, the code was "taken" and "modified" without my approval before it had CW functionality), ShipHUD, DamageMeters, WhisperWindow, and EPMH and CheckpointCalc (two add-ons I haven't released publicly and were really just code that I toyed with).

It is a really nice add-on because its very much like an end-all configuration system of sorts that allows for developers to add in additional configurations they might have avoided because of all the time and memory resources needed to make configuration GUIs. It's almost become second nature for me to quickly slap in events to create new configuration fields without having to go into creating new buttons, resizing textures, so on.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Next

Return to Addons