Posted 06 January 2013 - 09:40 AM
Hello :D/>
two "i am trying to" xD :o/>
|
V
I am trying to improve my right click menu a bit..
i am trying to make a function, which add's a right click menu, with the menus, i want..
when i call the "sRM" (screen Right-Menu) then i type in this ( in a function which looks for the right mouse button to be pressed:
color code:
and my Add menu function looks like this:
( Please note that the tT, tW, tB, tP functions are written by myself ( will show full code last ) )
Full Code:
But… now to the problem..
when i rightclick, it show everything fine.
it shows me this error:
parallel:22: test1:159:
attempt to perform arithemetic __add on table and number
– on pastebin its at line 159 …
and.. i actually knows what the error is, but when the error is solved, then my right click menu still does not work.. ( it kinda mess up the whole screen )
((Thats because i posted my code before solving the attempt issue, so you could get a better knowledge about my code. ))
PS: its pretty hard to explain it more that this, so i cant promise, that i would be able to explain it better. ( about how to make add right menu, etc… )
I hope someone would help me.
Thanks in advance.
two "i am trying to" xD :o/>
|
V
I am trying to improve my right click menu a bit..
i am trying to make a function, which add's a right click menu, with the menus, i want..
when i call the "sRM" (screen Right-Menu) then i type in this ( in a function which looks for the right mouse button to be pressed:
-- the first two args has to be the X, and Y chors, for the menu..
sRM(xM1, yM1, black, white, "Stop", "Test") -- the last args, has to be the menus i want to add.. ( i want it so i could add infinite )
-- the third and forth arg, has to be the Background and TextColor (the black and white, is made by this local color code)
(the above sRM code is coded into this:
function mouse()
local event, mB1, xM1, yM1 = os.pullEvent("mouse_click")
if event == "mouse_click" then
if mB1 == 2 then
sRM(xM1, yM1, black, white, "Stop", "Shop")
elseif mB1 == 1 then
end
end
end
color code:
local white, orange, magenta, lightBlue, yellow, lime, pink, gray, lightGray, cyan, purple, blue, brown, green, red, black = colors.white, colors.orange, colors.magenta, colors.lightBlue, colors.yellow, colors.lime, colors.pink, colors.gray, colors.lightGray, colors.cyan, colors.purple, colors.blue, colors.brown, colors.green, colors.red, colors.black
-- This is in ONE line...
and my Add menu function looks like this:
( Please note that the tT, tW, tB, tP functions are written by myself ( will show full code last ) )
Spoiler
function sRM(...) -- XCor, YCor, BacColor, TxtColor, Menus --
if sRM then
local tArgs = {...}
if #tArgs ~= nil then
tP(tArgs[1],tArgs[2])
tB(tArgs[3])
tT(tArgs[4])
tW(" ")
local x = tArgs[1]
local y = tArgs[2]
local aLg = 5
y = y + 1
repeat
tP(x, y)
tW(tArgs[aLg])
y = y + 1
aLg = aLg + 1
until #tArgs == nil
end
end
end
Spoiler
function tP(x,y)
term.setCursorPos(x,y)
end
function tB(color)
term.setBackgroundColor(color)
end
function tT(color)
term.setTextColor(color)
end
function tCP(x,y)
tP(x,y)
term.write(" ")
end
function tW(txt)
term.write(txt)
end
function clearL()
term.clearLine()
end
function clear()
term.clear()
end
Full Code:
But… now to the problem..
when i rightclick, it show everything fine.
it shows me this error:
parallel:22: test1:159:
attempt to perform arithemetic __add on table and number
– on pastebin its at line 159 …
and.. i actually knows what the error is, but when the error is solved, then my right click menu still does not work.. ( it kinda mess up the whole screen )
((Thats because i posted my code before solving the attempt issue, so you could get a better knowledge about my code. ))
PS: its pretty hard to explain it more that this, so i cant promise, that i would be able to explain it better. ( about how to make add right menu, etc… )
I hope someone would help me.
Thanks in advance.