Post by tyreafus on Nov 9, 2005 23:06:24 GMT -5
I'm working on a script to make an alarm go off when you get a party invite, allowing you to do something besides sit at the keyboard while you wait for a party. I haven't programmed anything since high school, so I'm definitely a little rusty. Also I have absolutely no experience with Lua, but I think I'm starting to get a hold on it. I decided to use the ingame /p <call1> for the alarm because I'm not sure how to use external sound files in Lua. Since you're not in a party when you get an invite, it'll only show up on your computer anyway^^.
I think I've worked out most of the kinks , but I still can't get the thing to work. I think the chat commands for Lunar are still buggy(as the docs said). Also I seem to have problems if I run a script more than once in a session, even if the script has ended or I've unloaded it via the console.
Anyway, I figured I'd post what I have so far, maybe some of you will see something I'm missing. I'm not sure how you all make those code boxes so I'm just gonna have to post it as regular text:
I got the 87 using another script i made to test the colors and types of chatlog text. So TinyTerror if you read this you can put 87 on the documentation for FFXI.chat_GetLineType for Party Invites. I did have trouble with the script I made to test it though. Even after the script had ended the debug window was showing constant looped activity, pulling information from the chat log. I'm not sure why that is. Here is my code for that in case anyone needs to test a chat-text type not already listed in the docs, or for debugging purposes:
Suggestions are welcome.
I think I've worked out most of the kinks , but I still can't get the thing to work. I think the chat commands for Lunar are still buggy(as the docs said). Also I seem to have problems if I run a script more than once in a session, even if the script has ended or I've unloaded it via the console.
Anyway, I figured I'd post what I have so far, maybe some of you will see something I'm missing. I'm not sure how you all make those code boxes so I'm just gonna have to post it as regular text:
a=true
Control.control_BindKey("RBRACKET",true,false,true,"keyboard_sendstring /echo stop")
Control.control_SendString("/echo Start")
while a==true do
Wi[sup][/sup]ndower.script_sleep(50)
newlinenum=FFXI.chat_GetNewestLineNumber()
newline=FFXI.chat_GetLine(newlinenum)
newline = newline .. " "
linetype=FFXI.chat_GetLineType(newlinenum)
if newline=="stop " then
a=false
end
if linetype=="87" then
local firstspc = string.find(newline, (" "))
firstspc=firstspc+1
local endinv=sfirstspc+27
local testline=string.sub(newline,spaces,endinv)
if testline=="invites you to join a party." then
Windower.script_Sleep(1000)
Control.control_SendString("/p <call1>")
end
end
end
Windower.script_Sleep(1000)
Control.control_SendString("/echo End.")
I got the 87 using another script i made to test the colors and types of chatlog text. So TinyTerror if you read this you can put 87 on the documentation for FFXI.chat_GetLineType for Party Invites. I did have trouble with the script I made to test it though. Even after the script had ended the debug window was showing constant looped activity, pulling information from the chat log. I'm not sure why that is. Here is my code for that in case anyone needs to test a chat-text type not already listed in the docs, or for debugging purposes:
function DispLine(LnTxt, LnTyp, LnClr)
DispTxt = Graphics.text_CreateObject()
DispType = Graphics.text_CreateObject()
DispColor = Graphics.text_CreateObject()
--
Graphics.text_SetBold(true,DispTxt)
Graphics.text_SetColor(255,255,255,255,DispTxt)
Graphics.text_SetPosition(50,50,DispTxt)
Graphics.text_SetText(LnTxt,DispTxt)
--
Graphics.text_SetBold(true,DispType)
Graphics.text_SetColor(255,255,255,255,DispType)
Graphics.text_SetPosition(50,75,DispType)
Graphics.text_SetText(LnTyp,DispType)
--
Graphics.text_SetBold(true,DispColor)
Graphics.text_SetColor(255,255,255,255,DispColor)
Graphics.text_SetPosition(80,75,DispColor)
Graphics.text_SetText(LnClr,DispColor)
return 0
end
--
Control.control_BindKey("LBRACKET",true,false,true,"keyboard_sendstring /echo stop")
Windower.script_Sleep(1000)
Control.control_SendString("/echo Start")
a=true
--
while a==true do
newnum=FFXI.chat_GetNewestLineNumber()
newline=FFXI.chat_GetLine(newnum)
if newline == "stop" then
a=false
end
newtype=FFXI.chat_GetLineType(newnum)
newcolor=FFXI.chat_GetLineColor(newnum)
Graphics.text_DeleteAll()
b=DispLine(newline, newtype, newcolor)
Windower.script_Sleep(50)
end
Suggestions are welcome.