SwapRaidSubgroup with String...
hi, i work on a little function that sorts my raid from a string that i give...
Code:
function doRaid() it came from this page: http://absence-gilde.com/?p=raidposi&b=1&s=1&g=1&u=0&e to swap Ikuria in Group 4 and Achot to 2, but now the problem - if the group is full, it doesnt work - so i test it to count the group and if full then use swap, but... hmmm i have not the skill to do it right... can someone help? |
Not tested at all, but something like this should work. I think your main problems are that (1) you're not updating the current raid state table when you make a swap, and (2) you're quitting after making one swap.
Code:
local current, numInGroup = {}, {} |
theres is a problem with
Code:
local raidState, numInGroup = {}, {} testing with 2 other people in raid, and it doesnt work |
Fixed; edited my previous post.
|
thanks for help, but it doesnt work... i always find errors,
wipe(raidstate) raidstate is old array right? current undefined index (name?) so there is no name in the updateraidstate funktion, same on numInGroup key (group) i think... so, if you have time, can you check this addon ingame? |
okay i killed the most errors, but now i think the regex is wrong, can you help with that?
name:2&name:5&name:1 name:group [edit] found: Code:
"([^&:]+):(%d+)" 3x Raidstring\Raidstring.lua:51: attempt to compare nil with number |
Done, worked (hope in raid too)
Code:
SLASH_RAIDSTRING1 = "/rs" Raidassist Page: http://absence-gilde.com/?p=raidposi&b=1&s=1&g=1&u=0&e |
Just a couple things:
1. You're creating a lot of generically named global variables like "ClassTable" and "setContains". Don't do this. Make those variables local instead, or (if they need to be accessed from other addons or via in-game /run commands) at least give them distinct names, like "MyAddonName_ClassTable" and "MyAddonName_SetContains". Globals are slower to access than locals, and generically named globals have a tendency to overwrite (or be overwritten by) other generacally named globals from other addons or even the default UI. For example, at one point many authors were lazily putting a variable named "_" in the global namespace. Then Blizzard accidentally did the same thing, and suddenly there were hundreds of addons completely breaking parts of the default UI because they were tainting the "_" global. Also, if users see an error message about "setContains" they won't have any idea what that means, or what's causing it. If they see an error about "MyAddonName_SetContains" they can immediately tell which addon is causing that error, and tell you about the problem. 2. Your "setContains" function in general is completely useless. Instead of if setContains(tbl, "x") then, just do if tbl["x"] then. There's no reason to explicitly check it against nil unless you need to distinguish between nil and false for some reason, and even then, you should just do it directly instead of wasting CPU time on an extra function call. Calling functions is about the slowest thing you can do in Lua, so you should avoid doing it when you don't need to do it. 3. After having said all that, you're not actually using either the "ClassTable" table or the "setContains" function so you should just remove them and clean up any other variables you're not using. :p |
please make it right, and post it for me :(
|
Code:
SLASH_RAIDSTRING1 = "/rs" |
Just blindly adding local keywords isn't a good idea, as that code has scoping issues and will throw errors about attempting to index nil values. Also, you didn't remove the unused stuff. :p
Code:
local current, numInGroup = {}, {} |
Code:
local membercount = Code:
1x <string>:"URLFrameEditBox:OnEnterPressed":1: attempt to call global "SortRaid" (a nil value) |
You need to post the other file(s). The code you posted doesn't create the URLEditBox frame, and that error is from that missing code.
|
send you pm @ phanx
|
I don't provide any support or tutoring via PM, as that defeats the point of having a community forum, so I'm just replying here.
Quote:
Code:
local f = CreateFrame("Frame", "Raidstring", UIParent) |
thanks, i will test it... found a little error, but i can fixed it - thanks for your endurance ^^
|
Phanx' endurance makes even guys blush.
|
I lol'ed. :D
|
it still said "group is full" so the switching is not right :(
|
Change this:
Code:
if numInGroup[group] or numInGroup[group] < 5 then Code:
if not numInGroup[group] or numInGroup[group] < 5 then |
All times are GMT -6. The time now is 01:42 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI