Consider helping out in updating the wiki for 3.4.0 - see Path_of_Exile_Wiki:To-do_list/3.4.0

Various people have reported issues with the ads on here. Make sure to report those advertisements

User talk:Illviljan

From Path of Exile Wiki
Jump to: navigation, search

I think that info about tools for calculating talisman item level shoud be there where info about calculating talisman item level is, otherwise no one will see it.

I moved it down for consistency. Most external links are placed at the bottom of the page on this wiki, for example Chromatic Orbs, auras. I believe this is also common practice on wikipedia.org as well. --Illviljan (talk) 12:42, 16 January 2016 (UTC)

Tips to improve your coding style

Hey, some tips to improve your coding style based on recent edit on Module:SMW data tables, I'll probably add it to general style guidelines too at some point

--
-- Shorten expressions when you can, this avoids performance overhead and is better readability
--

-- Don't
not (var == nil)
-- Do
var ~= nil

--
-- Use string format over .. for better readability.
-- For large strings you want to make a table and connect in one go, that's much faster.
--

-- Meh
"#ask:[[Is event::" .. g_args['type'] .. "]] [[Has release date::<" .. g_args['release_date'] .. "]]"
-- Better
string.format("#ask:[[Is event::%s]] [[Has release date::<%s]]", g_args.type, g_args.release_date)


-- meh
local out = ''
out = out .. 'a'
out = out .. 'b'
out = out .. 'c'
out = out .. 'd'
return ''

-- better
local out = {}
out[#out+1] = 'a'
out[#out+1] = 'b'
out[#out+1] = 'c'
out[#out+1] = 'd'
return table.concat(out, '')

--
-- Use local variables when it doesn't need to be in the argument dict
--

-- Don't
g_args['out'] = '<div style="text-align: left;">'

-- do
local out = '<div style="text-align: left;">'

--
-- Avoid code duplication
--

-- Current
-- Both lines do a lot of things that are basically the same
if g_args['image'] == nil then 
    g_args['picture'] = '<div class="image"> [[File:' .. g_args['name'] .. ' logo.png|alt=|250px]]</div>' 
else 
    g_args['picture'] = '<div class="image"> [[File:' .. g_args['image'] .. '|alt=|250px]]</div>'
end

-- Better
local picture
if g_args['image'] == nil then 
    picture = g_args['name'] .. ' logo.png' 
else 
    picture = g_args['image']
end
picture = string.format('<div class="image"> [[File:%s|alt=|250px]]</div>', picture)

-- 
-- There are lot of cases where you do a lot if ... elseif ... elseif ... end that basically do the same.
-- Look at some of my other modules, you can use a table to cut the code significantly down as well as making things easier to read
--

-- Example
if g_args['type'] == 'challenge' then
    g_args['type'] 			= 'Challenge league'
    g_args['short_name'] 		= g_args['name']:lower():gsub('league', ''):gsub('^%l', string.upper)
    g_args['ordinal_number'] 	= g_frame:callParserFunction("#ask:[[Is event::" .. g_args['type'] .. "]] [[Has release date::<" .. g_args['release_date'] .. "]]", "format=count")
elseif g_args['type'] == 'expansion' then
    g_args['type'] 			= 'Expansion'
    g_args['short_name'] 		= g_args['name'] 
    g_args['ordinal_number'] 	= g_frame:callParserFunction("#ask:[[Is event::" .. g_args['type'] .. "]] [[Has release date::<" .. g_args['release_date'] .. "]]", "format=count")		
elseif g_args['type'] == 'pvp' then
    g_args['type'] 			= 'PvP season'
    g_args['short_name'] 		= g_args['name']:lower():gsub('pvp season', ''):gsub('^%l', string.upper)
    g_args['ordinal_number'] 	= g_frame:callParserFunction("#ask:[[Is event::" .. g_args['type'] .. "]] [[Has release date::<" .. g_args['release_date'] .. "]]", "format=count")							
elseif g_args['type'] == 'race' then
    g_args['type'] 			= 'Race season'	
    g_args['short_name'] 		= g_args['name']:lower():gsub('race season', ''):gsub('^%l', string.upper)
    g_args['ordinal_number'] 	= g_frame:callParserFunction("#ask:[[Is event::" .. g_args['type'] .. "]] [[Has release date::<" .. g_args['release_date'] .. "]]", "format=count")		
end

-- rework:
local types = {
    challenge = {
        name = 'Challenge league',
        short_name = function ()
            return g_args.name:lower():gsub('league', ''):gsub('^%l', string.upper)
        end
    },
    -- add expansion/pvp/race here too
}

local type_data = types[g_args.type]
if type_data ~= nil then
    g_args.type = type_data.name
    -- we know this is a function, so it can be called
    g_args.short_name = type_data.short_name()
    g_args.ordinal_number = g_frame:callParserFunction(string.format("#ask:[[Is event::%s]] [[Has release date::<%s]]", g_args.type, g_args.release_date), "format=count")	
end

--OmegaK2 (t|c) 21:15, 29 July 2016 (UTC)

Thanks. I might as well add some things that I've been wondering about.
  1. I've been favoring g_args because that's what h.handle_mapped_property_args(map) in Module:SMW_data_tables seems to require. How is that solved with local arguments?
  2. You seem to favor g_args.i over g_args['i'], why? g_args['i'] seems better after my testings since variables can easily be used, in for loops etc.
--Illviljan (talk) 22:00, 29 July 2016 (UTC)
1. Well yeah for that specific usage it makes sense, but otherwise don't. What the function does is pretty simple actually and what you're using here is pretty much resembling what I'm doing in the item module. I think it might be a good idea to put it into the util module (the whole "get argument, validate argument, set semantic property if validated and valid argument", display stuff") eventually. The logic has been different in the different modules, but I think I'll find a way streamline that.
To answer that question in general outside of that use case, you can ofc pass arguments to other functions
2. the first format is less characters and as a result more readable imho. I don't think it really matters. The second one makes sense when you actually use variables or have key names that contain invalid characters (like spaces)
--OmegaK2 (t|c) 22:22, 29 July 2016 (UTC)

Broke Hatred

Help! I made an edit on Hatred, and the Skills module returns an error for it now, and I have no idea what it means. sl|Hatred returns -> Module Error: No results found for search parameter "hatred".

Could you tell me what I did wrong so that I can avoid it in the future? Thanks

--Swang30 (talk) 05:05, 21 December 2016 (UTC)

It wasn't you, I broke Hatred (and a few other gems...). If you check Recent changes on the sidebar you'll see I tried a simple thing with a important module around that time but I failed and broke it instead. :) --Illviljan (talk) 08:29, 21 December 2016 (UTC)

Per Infobox vs. master price

I'm wondering - is it something that's agreed by PoE editors or own opinion? As far as I've seen infobox is just a short version of some data. In this case infobox hasn't doubled informations - it's just price and thing I've added was giving more informations. For new player vendor price isn't "something you can buy randomly from masters". It's obvious only for people who are into game a lot, i.e. they have hideout with leveled masters. Krzysiunet (talk) 20:51, 27 August 2017 (UTC)

{{Item}} is taking over the role that {{MasterUniquePrice}} and {{Item price}} was doing because it is supported by PyPoE and SMW. Two things that greatly helps us keeping the wiki up to date. Do you not think it is wasted time to maintain two values, one which is maintained manually, on 700+ pages? The hoover text for Purchase Cost on Martial ArtistryMartial Artistry
Crimson Jewel
Limited to: 1(10-15)% increased Area of Effect while UnarmedA gentle hand rarely leaves a mark on the world.Place into an allocated Jewel Socket on the Passive Skill Tree. Right click to remove from the Socket.
do explain that it can be bought from NPCs, but what are NPCs? I agree that the hoover text, unique item page and the real NPC page could certainly be improved to more clearly convey that.--Illviljan (talk) 22:00, 27 August 2017 (UTC)

Move of /sandbox page

Hi, just wanted to say thanks for moving the sandbox page i accidentally created. I got confused between my profile page and user page and created that link erroneously. Then i forgot what i was doing and neglected to clean it up. Thanks again! Alleryn (talk) 10:11, 31 August 2017 (UTC)