Aardwolf campaign in another window

Posted by Findingthelimit on Fri 10 Jul 2009 02:05 PM — 5 posts, 23,834 views.

#0
I've tried edited the global quest plugin and there are times that it won't work when I try to output into another window. It also does strange things as it really was specifically written for global quests and without completely rewriting it I can't fix it. It's really difficult to follow. This is all I want the plugin to do. I have a world called "Campaign" I wish to send the "cp check" list to. It can update when a monster is killed or when I do cp check again.
Australia Forum Administrator #1
Which plugin did you edit? Can you give a link to it?

I have a plugin that does global quests - see this thread:

http://www.gammon.com.au/forum/?id=8815

That does a "cp check" when it gets a message that you killed a campaign mob.
#2
I don't want it in a "mini-window." I wanted it in another world.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Sunday, October 15, 2006, 5:29 AM -->
<!-- MuClient version 3.74 -->

<!-- Plugin "Aardwolf_GQuest_SeparateLUA" generated by Plugin Wizard -->

<muclient>
<plugin
name="Aardwolf_GQuest_SeparateLUA"
author="Onoitsu2"
id="8ac19d8143d49dea2fb5c6a4"
language="Lua"
purpose="Displays the GQuest Check on Aardwolf within another window"
save_state="y"
date_written="2006-10-15 05:27:29"
requires="3.74"
version="1.1"
>
<description trim="n">
<![CDATA[

]]>
</description>

</plugin>


<!-- Get our standard constants -->

<include name="constants.lua"/>

<!-- Aliases -->

<aliases>
<alias
match="^Aard\_GQ set (.*?)$"
enabled="y"
group="AardGQAlias"
regexp="y"
script="Aard_GQ_Set"
send_to="12"
omit_from_output="y"
ignore_case="y"
sequence="100"
>
</alias>
<alias
match="^cp?\s?c(heck)?$"
enabled="y"
group="AardGQAlias"
regexp="y"
script="Aard_GQ_Check"
send_to="12"
ignore_case="y"
sequence="100"
>
</alias>
</aliases>


<!-- Triggers -->

<triggers>
<trigger
group="AardGQ_Send"
ignore_case="y"
match="^You still have to kill \* (.*?) \((.*?)\)\.$"
name="GQ_Send"
omit_from_log="y"
omit_from_output="y"
regexp="y"
script="GQ_Send"
send_to="12"
sequence="100"
>
</trigger>
<trigger
group="AardGQ_Send"
ignore_case="y"
match="^$"
name="GQ_End"
omit_from_log="y"
omit_from_output="y"
regexp="y"
script="GQ_End"
send_to="12"
sequence="100"
>
</trigger>
</triggers>

<!-- Plugin help -->

<aliases>
<alias
script="OnHelp"
match="Aard_GQ help"
enabled="y"
ignore_case="y"
>
</alias>
</aliases>

<script>
<![CDATA[
-- Start Customize Area
-- GQ Check Text Color
mobtext = "darkolivegreen"
-- GQ Check Dead Back Color
mobdead = "dimgrey"
-- GQ Check Alive Back Color
mobalive = "grey"
-- GQ Check Total Text Color
totaltext = "greenyellow"
-- GQ Check Total Back Color
totalback = "dimgrey"
-- End Customize Area

-- ADD ALL AREAS TO THIS TABLE
areas={}
mobs = 0

worldname = GetVariable("worldname")
if worldname == nil or worldname == "" then
worldname = ""
ColourNote("white", "red", "AardGQ 'Send To' Window NOT Set!")
end -- if

function Aard_GQ_Set(sName,sLine,wildcards)
if wildcards[1] == "" then
ColourNote("white", "red", "AardGQ 'Send To' Window NOT Set!")
else
SetVariable("worldname",wildcards[1])
worldname = wildcards[1]
ColourNote("white", "green", "AardGQ 'Send To' Window Set To '" .. worldname .. "'!")
SaveState()
end -- if
end -- Aard_GQ_Set

function Aard_GQ_Check(sName,sLine,wildcards)
mobs = 0
EnableTriggerGroup("AardGQ_Send",1)
SendNoEcho("cp check")
local send_to_me = GetWorld(worldname)
if send_to_me ~= nil then
send_to_me:DeleteOutput()
else
ColourNote("white", "red", "AardGQ 'Send To' Window (" .. worldname .. ") NOT Open!")
end -- if
end -- Aard_GQ_Check

function GQ_End(sName,sLine,wildcards)
EnableTriggerGroup("AardGQ_Send",0)
local send_to_me = GetWorld(worldname)
if send_to_me ~= nil then
send_to_me:Note()
send_to_me:ColourNote(totaltext,totalback,mobs .. " = Total Mobs Left")
else
Note()
ColourNote(totaltext,totalback,mobs .. " = Total Mobs Left")
end -- if
end -- GQ_End

function GQ_Send(sName,sLine,wildcards,STYLES)
mobs = mobs + 1
local send_to_me = GetWorld(worldname)
if send_to_me ~= nil then
local str = {}

--local linestyles = table.getn(STYLES)
--for style = 1, linestyles do
local found, numareas = 0, table.getn(areas)
for area = 1, numareas do
if string.lower(areas[area]) == string.lower(wildcards[2]) then
found = 1
break
end -- if
end -- for
if found == 1 then
table.insert (str, mobtext)
table.insert (str, mobdead)
else
table.insert (str, mobtext)
table.insert (str, mobalive)
--table.insert (str, RGBColourToName(STYLES[style]["textcolour"]))
--table.insert (str, RGBColourToName(STYLES[style]["backcolour"]))
end -- if
--table.insert (str, STYLES[style]["text"])
table.insert (str, wildcards[1] .. " * " .. wildcards[2] .. " (" .. wildcards[2] .. ")")
--end -- for
send_to_me:ColourNote (unpack (str))
else
local str = {}
--local linestyles = table.getn(STYLES)
--for style = 1, linestyles do
--table.insert (str, RGBColourToName(STYLES[style]["textcolour"]))
--table.insert (str, RGBColourToName(STYLES[style]["backcolour"]))
--table.insert (str, STYLES[style]["text"])
--end -- for

local found, numareas = 0, table.getn(areas)
for area = 1, numareas do
if string.lower(areas[area]) == string.lower(wildcards[3]) then
found = 1
end -- if
end -- for
if found == 1 then
table.insert (str, mobtext)
table.insert (str, dimgrey)
else
table.insert (str, mobtext)
table.insert (str, mobalive)
end -- if
table.insert (str, wildcards[1] .. " * " .. wildcards[2] .. " (" .. wildcards[3] .. ")")
ColourNote(unpack(str))
end -- if
end -- GQ_Send

function OnPluginInstall()
OnHelp()
end -- OnPluginInstall

function OnHelp ()
Note (GetPluginInfo (GetPluginID (), 3))
end
]]>
</script>

</muclient>


*Truncated the help and the table to get it into this post

In particular it breaks when places like castle-vlad shamir are the first target. I believe I attempted to alter that miniwindow as well but I don't understand how to send things simply to other windows. I don't need 3 wildcards I think for what I want to do. Just capture the mob/area to the period and that gquest helper tried to supply like the room or something and that's unnecessary to me, esp if I can't get the simple version to work.
Australia Forum Administrator #3
Quote:

... I don't understand how to send things simply to other windows ...


This is where that is done:


local send_to_me = GetWorld (worldname)
if send_to_me then  -- if world found
  send_to_me:Note()
  send_to_me:ColourNote (totaltext, totalback, mobs .. " = Total Mobs Left")
end -- if


I neatened it up a bit. ;)

GetWorld gets a userdatum which is the other world "object". Assuming that is not nil (which is what the if test checks for) then you can put that world object in front of other commands like Note, ColourNote etc. to send to that world, as done above.

http://www.gammon.com.au/scripts/doc.php?function=GetWorld
#4
okay thanks I'll try messing with it again and let you know how it ends up.