Pirate The World - Online Adventure Game
https://forum.piratetheworld.com/

Cashout adder
https://forum.piratetheworld.com/viewtopic.php?f=15&t=2549
Page 1 of 1

Author:  Darkmyst9 [ Mon May 26, 2008 10:47 pm ]
Post subject:  Cashout adder

Not sure if anyone will find this script useful, but it adds up cashout threads for you and gives you the totals, averages, etc:

<html>
<head><title>Cashout Adder</title></head>
<body>
<script language="vbs">
Sub GetValues
Dim HoldText, SplitText, SplitTotal, SplitCount, DataHold, DataSplit, DataCount, DataValues, DataTitles, DataTotal, NamesTotal

DataTitles = Split("Names in list,Number of people,SD total,GD total,Average number of SD,Average number of GD", ",")
DataTotal = UBound(DataTitles)
ReDim DataValues(DataTotal)
HoldText = GetText.Value
SplitText = Split(HoldText, vbCrLf)
SplitTotal = UBound(SplitText)
If SplitTotal > 0 Then
For SplitCount = 0 To SplitTotal
DataHold = Trim(SplitText(SplitCount))
If DataHold = "" Then Exit For
DataSplit = Split(DataHold, "-")
DataValues(0) = DataValues(0) & Trim(DataSplit(0)) & ", "
DataSplit = Split(Mid(DataHold, InStr(DataHold, "-") + 1, Len(DataHold)), ",")
For DataCount = 0 To UBound(DataSplit)
If InStr(DataSplit(DataCount), "SD") <> 0 Then DataValues(2) = DataValues(2) + CByte(left(DataSplit(DataCount),InStrRev(DataSplit(DataCount), " ")))
If InStr(DataSplit(DataCount), "GD") <> 0 Then DataValues(3) = DataValues(3) + CByte(left(DataSplit(DataCount),InStrRev(DataSplit(DataCount), " ")))
Next
Next
NamesTotal = UBound(Split(DataValues(0)))
DataValues(4) = Round(DataValues(2) / NamesTotal, 2)
DataValues(5) = Round(DataValues(3) / NamesTotal, 2)
DataValues(0) = Left(DataValues(0), Len(DataValues(0)) - 2)
DataValues(1) = NamesTotal
ShowValues.innerHTML=""
For DataCount = 0 To DataTotal
ShowValues.innerHTML = ShowValues.innerHTML & "<p>" & DataTitles(DataCount) & ": " & DataValues(DataCount) & "</p>"
Next
ShowValues.innerHTML = ShowValues.innerHTML & "<p>Data excludes piracy ranks, please add 120 to the total GD to find the number of GD given in total.</p>"
GetText.Value = "Ready for more data."
Else
GetText.Value = "Please retry."
MsgBox "Data invaild", vbCritical
End If
End Sub
</script>
First paste the cash out values in the box below:
<p><textarea rows="1" name="GetText" cols="43"></textarea></p>
<p>Then click button to get results:</p>
<p><input type="button" value="Go" name="DoWork" onclick="GetValues"></p>
<hr>
<form id="ShowValues"></form>
</body>
</html>

To use it just copy from the start of "<html>" to the end of "</html>". Then paste it to 'Notepad' and save it with ".htm" at the end. You should now have a file like "Adder.htm" depending on what you called it. Double click this file and it will open in your default web browser, though this script will probably only work in IE. Next find the thread you want to add, copy the text, and paste into the text box you will see once you start this script. Next click the button and it will give you the results.

E.g:
Start my script and in a new window open viewtopic.php?f=17&t=2529 . Highlight from the start of "Larry" to the end of the last "SD". Right click and pick "Copy". Switch back to the window you have the script open in, left click the text box, then right click the text box and pick "Paste". Lastly left click the command button which is labeled "Go". It will then give you the new data it's just added up.

Author:  Cremaster [ Sat Jun 07, 2008 5:24 pm ]
Post subject:  Re: Cashout adder

That is a kewl script Ralph!!!!

Author:  Darkmyst9 [ Sat Jun 07, 2008 8:48 pm ]
Post subject:  Re: Cashout adder

Thanks. Not sure if it will have a use next month, but will have to wait and see.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/