alias donations {
var %one $read(%donateFile,n,1)
;echo -a DonateFile: %one
var %two $read(%checkFile,n,1)
;echo -a CheckFile: %two
var %name $gettok(%one,1,38)
;echo -a Username: %name
var %message $gettok(%one,2,38)
if (%message == $chr(32)) || (%message == $null) || (%message == $chr(38)) {
var %message default
}
;echo -a Message: %message
var %donate $gettok(%one,3,38)
;echo -a Donate: %donate
;This line removes the $ from the dollar amount donated. To work with the system easier.
var %donateamount $mid(%donate,3)
;echo -a DonateAmount: %donateamount
if (%one === %two) { return }
;Calls the donation alias to then convert donate amount to whole number and times it by 6 for points to be added to user who donated.
;donation %name %donateamount
;Currently sitting at 15 total
var %soundcodes [BABY] [BANE] [CHCK] [DOOM] [ELCO] [ELTO] [IGBO] [MATI] [MONK] [MOOO] [MORS] [NONO] [PEWP] [TOOT] [BOON] [DINO] [SQUI] [DUKE] [BAYM] [DWDU] [MILI]
var %soundrand 1 3 1 1 1 1 1 4 1 1 1 1 1 1 2 1 1 16 1 1 1
;Sets an incremental variable
var %a 1
while ($gettok(%soundcodes,%a,32) != $null) {
var %v $v1
;echo -a v: %v
if ($istok(%message,%v,32)) {
var %tof $v1
}
if (%v isin %message) {
var %vs $v1
var %vss $mid(%vs,2,4)
;echo -a vss: %vss
;echo -a a: %a
var %vsss %vss $+ $rand(1,$gettok(%soundrand,%a,32))
splay %donateSounds $+ %vsss $+ .mp3
}
inc %a
}
if (%tof == $null) {
splay %sounds $+ Alerts-Donation-Online.mp3
}
;clears out the %checkFile to prevent extra 0's at the end of the line.
write -c %checkFile
bset &a 1 $regsubex(%one,/(.)/g,$asc(\1) $+ $chr(32))
bwrite %checkFile 0 -1 &a
echo -a New Donation: $read(%checkFile,n,1)
}