Help - Search - Members - Calendar
Full Version: Rat Counter
Achaea's Forums > Off-Topic > Tech Support
Flurr
I have this error: [string "Script file"]:1: unexpected symbol near '<'

when I have Keldar's ratting counter in External Script file and this is whats in it:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE muclient >

<muclient>
<plugin name="Ratter" author="Keldar" language="vbscript" purpose="Display ratting info"
save_state="y" date_written="2003-11-15" date_modified="2003-11-16" requires="3.32" version="1.0"
id="152d7cdff704e856e0c00d58">

<description trim="y">

<![CDATA[
This simple plugin will display the basic statistics of your ratting. It
uses the Info bar for display, and can show either counts for each type
of rat you have slain so far, or their gold worths. The commands to use it
are:

ratter on|off - turn the Ratter on or off, turning it off resets the current count
ratter nums|gold - defines whether the plugin will display amounts or gold values
of rats
rats * - * stands for a ratman's name, sends 'sell rats to *'

]]>
</description>

</plugin>
<include name="constants.vbs" />

<triggers>
<trigger
name="RatPickup"
enabled="n"
regexp="y"
match="^You have slain (?:a|an) (baby rat|young rat|rat|old rat|black rat), retrieving the corpse\.$"
script="CountRats"
keep_evaluating="y"
sequence="10"
></trigger>
</triggers>

<aliases>
<alias
name="ratter_switch"
enabled="y"
regexp="y"
match="^ratter (on|off|nums|gold)$"
sequence="100"
script="Ratter"
/>
<alias
name="sellrats"
enabled="y"
match="rats *"
sequence="100"
><send>sell rats to %1</send></alias>
</aliases>

<script>
<![CDATA[

dim displayMode
displayMode = 1 '1 displays amounts, 2 - gold values

dim ratPrice(5) 'This array holds prices for different rats
ratPrice(0) = 7 'baby rat
ratPrice(1) = 14 'young rat
ratPrice(2) = 21 'rat
ratPrice(3) = 28 'old rat
ratPrice(4) = 35 'black rat

dim ratNums(5) 'This array holds the number of different rats you've killed
ratNums(0) = 0 'baby rats
ratNums(1) = 0 'young rats
ratNums(2) = 0 'rats
ratNums(3) = 0 'old rats
ratNums(4) = 0 'black rats

sub Ratter(name, output, wildcs)
select case wildcs(1)
case "on"
world.EnableTrigger "RatPickup", 1
DisplayInfo
world.Note "Ratter plugin is ON"
case "off"
world.EnableTrigger "RatPickup", 0
world.InfoClear
world.InfoBackground "lightgrey"
dim i
for i = 0 to ubound(ratNums)
ratNums(i) = 0
next
displayMode = 1
world.Note "Ratter plugin is OFF"
case "nums"
displayMode = 1
DisplayInfo
case "gold"
displayMode = 2
DisplayInfo
end select
end sub

sub CountRats(name, output, wildcs)
select case wildcs(1)
case "baby rat"
ratNums(0) = ratNums(0) + 1
case "young rat"
ratNums(1) = ratNums(1) + 1
case "rat"
ratNums(2) = ratNums(2) + 1
case "old rat"
ratNums(3) = ratNums(3) + 1
case "black rat"
ratNums(4) = ratNums(4) + 1
end select
DisplayInfo
end sub

sub DisplayInfo
world.InfoClear
world.InfoFont "FixedSys", 12, 0
world.InfoColour "white"
world.InfoBackground "black"
dim totalNums, totalGold, i
totalNums = 0
totalGold = 0
for i = 0 to ubound(ratNums)
totalNums = totalNums + ratNums(i)
next
if (displayMode = 1) then
world.Info "Total: " & cstr(totalNums) & " | "
world.Info "Baby rats: " & cstr(ratNums(0)) & " | "
world.Info "Young Rats: " & cstr(ratNums(1)) & " | "
world.Info "Rats: " & cstr(ratNums(2)) & " | "
world.Info "Old rats: " & cstr(ratNums(3)) & " | "
world.Info "Black rats " & cstr(ratNums(4))
elseif (displayMode = 2) then
for i = 0 to ubound(ratNums)
totalGold = totalGold + ratNums(i)*ratPrice(i)
next
world.Info "Total: " & cstr(totalGold) & "gp | "
world.Info "Baby rats: " & cstr(ratNums(0)*ratPrice(0)) & "gp | "
world.Info "Young Rats: " & cstr(ratNums(1)*ratPrice(1)) & "gp | "
world.Info "Rats: " & cstr(ratNums(2)*ratPrice(2)) & "gp | "
world.Info "Old rats: " & cstr(ratNums(3)*ratPrice(3)) & "gp | "
world.Info "Black rats " & cstr(ratNums(4)*ratPrice(4)) & "gp"
end if
end sub
]]>
</script>

</muclient>

I know that I need to change one thing but i can't remember or find it here or on Gammon's website
Gorlasintan
I'm pretty sure you need to import that as a plugin, not put it in the script file.
Flurr
QUOTE (Gorlasintan @ Sep 6 2009, 03:00 PM) *
I'm pretty sure you need to import that as a plugin, not put it in the script file.


I just opened a sample plugin and pasted the script into it and it worked some how, Thanks for the help. (not being sarcastic if it sounds like it is wacko.gif )
Trevize
QUOTE (Flurr @ Sep 7 2009, 12:37 AM) *
QUOTE (Gorlasintan @ Sep 6 2009, 03:00 PM) *
I'm pretty sure you need to import that as a plugin, not put it in the script file.


I just opened a sample plugin and pasted the script into it and it worked some how, Thanks for the help. (not being sarcastic if it sounds like it is wacko.gif )

Gorly is right, xml shouldn't be pasted into your script file. Add it as a plugin.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.