mIRC Home    About    Download    Register    News    Help

Print Thread
#248679 17/10/14 07:09 PM
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
So, basically. I have a few "goal's" for donations from my stream. Right now, I have my bot set up to message chat when I get a new donation automatically. What I want is for each donation I get to add to a total. So, if someone donates $10 it'll show as such:

BOT: DONATION! username [$10]
BOT: WHATEVERGOALHERE [$10/$50]

and then if someone else donates like $2 or whatever it pops up basically the same only automatically updating to [$12/$50] without me having to go in and do it manually.

The problems I've come across is, the way I track and alert the chat with a donation has the "$" in the file itself. Therefore I can't just add it without $ messing with any script I've tried. Any help would be appreciated.

For the purpose of helping me out here is the donation portion of the monitor script I have...

Code:
else if (%1 == C:\Users\myusername\Documents\donationfoler\recentdonation.txt) {
          msg # /me NEW DONATION$read(C:\Users\myusername\Documents\donationfolder\recentdonation.txt)
        }


obviously I'll have to add another

Code:
 ;add that donation to total towards goal
msg # WHATEVERGOAL: $chr(91) $+ $read(whatevergoal.txt) $+ / $+ $chr(36) $+ 50 $+ $chr(93)


Any help towards this is appreciated. Thanks in advance.

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
So, I've been working on this. Still. Even went back and looked for a few post's that might have helped and... well. Nothing. I've decided that for now I will use just a menu option to edit it manually. I can get it working to just overwrite the old file (obviously) but what I can't do is get it to $calc correctly. Here's what I've tried...



Code:
.Add to GOAL : /write -c GOAL.txt $calc($read(GOAL.txt, t) + $2) $$?="Enter Amount:" | msg $chan /me GOAL: $chr(36) $+ $read(GOAL.txt, t) $+ / $+ $chr(36) $+ 60

Now, with this one it only over writes the last input amount. for instance:

ME: (add's 5 to the amount)
BOT: $0 5/$60
ME: (add's 15 to the amount)
BOT: $0 15/$60

As you can see, it leave's "0" there and doesn't $calc anything at all...

I tried this as well after looking around on the forums, but it did the same exact thing...

Code:
write -11 GOAL.txt $calc($read(GOAL.txt,0) + $2) $$?="Enter Amount:"

Last edited by Bramzee; 18/10/14 02:50 PM.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
By default, $read will evaluate the text it reads as if it was mSL code. To prevent this behavior you must use the n switch. Unless you specifically want the text file to contain mSL code, you should make a habit of using -n when using $read to prevent abuse.

Last edited by Belhifet; 19/10/14 01:01 AM.
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Thanks for that smile
I thought using the t switch also read it as plain text as well? I have no idea why there is automatically a 0 in there... "$0 4/$60" for example. Any idea as to why that would be?


Link Copied to Clipboard