lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [branches/] [Hazado/] [functions.LUA] - Blame information for rev 45

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 45 Hazado-481
 
2 Hazado-481
--Window creator. Tides up the syntax on create
3 Hazado-481
MakeWindow = class(Turbine.UI.Window);
4 Hazado-481
 
5 Hazado-481
                function MakeWindow:Constructor(x,y,width,height,visible,colour,opacity)
6 Hazado-481
                        Turbine.UI.Window.Constructor( self )
7 Hazado-481
                        self :SetPosition( x,y);
8 Hazado-481
                        self :SetSize(width,height );
9 Hazado-481
                        self :SetVisible( visible );
10 Hazado-481
                        self :SetBackColor(colour);
11 Hazado-481
                        self :SetOpacity(opacity);
12 Hazado-481
                end
13 Hazado-481
 
14 Hazado-481
function SearchTable(InputTable,SearchString)
15 Hazado-481
--Will search the string for given results in a table. If found returns the row reference. So, for example I could look for "ore" in any items name. Used below.
16 Hazado-481
--BE AWARE! CASE SENSITIVE!
17 Hazado-481
        local found
18 Hazado-481
        local temp=0
19 Hazado-481
        --Check for a null item and return
20 Hazado-481
        if SearchString==0 then return 0 end
21 Hazado-481
 
22 Hazado-481
        for i = 1, # InputTable do
23 Hazado-481
 
24 Hazado-481
                if SearchString==InputTable[i] then  return i end --First check for an exact match
25 Hazado-481
 
26 Hazado-481
                --Now check for partial matches.
27 Hazado-481
                found,foo=string.find(SearchString,InputTable[i],0,true)
28 Hazado-481
 
29 Hazado-481
                if found ~=nil then
30 Hazado-481
                        temp= i
31 Hazado-481
                end
32 Hazado-481
        end
33 Hazado-481
        --if temp==0 then Turbine.Shell.WriteLine("Failed to find..."..SearchString) end
34 Hazado-481
        return temp
35 Hazado-481
end
36 Hazado-481
 
37 Hazado-481
function checker()
38 Hazado-481
        --will 'print' the information chosen below for the pack. Way of ensuring the order is what you are after.
39 Hazado-481
        local player = Turbine.Gameplay.LocalPlayer.GetInstance();      --Define player to be the player
40 Hazado-481
        local backpack = player:GetBackpack();                                  --Players backpack object
41 Hazado-481
        local size =backpack:GetSize()                                                          --How big it is
42 Hazado-481
        for i = 1, size do
43 Hazado-481
        item = backpack:GetItem(i);
44 Hazado-481
                if item ~= nil then
45 Hazado-481
                        Turbine.Shell.WriteLine(item:GetName().." is "..item:GetQuality())
46 Hazado-481
                end
47 Hazado-481
        end
48 Hazado-481
end
49 Hazado-481
 
50 Hazado-481
function mergetable(table1,list)
51 Hazado-481
--Appends tables from list on the end of table1
52 Hazado-481
for i=1,#list do
53 Hazado-481
        table2=list[i]
54 Hazado-481
                local LenTable1=#table1
55 Hazado-481
                for a =LenTable1+1,#table1+#table2 do
56 Hazado-481
                        table1[a]=table2[a-LenTable1]
57 Hazado-481
                end
58 Hazado-481
end
59 Hazado-481
end
60 Hazado-481
 

All times are GMT -5. The time now is 07:00 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui