mIRC Home    About    Download    Register    News    Help

Print Thread
#272351 17/01/24 05:32 AM
Joined: Aug 2014
Posts: 5
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Aug 2014
Posts: 5
I am trying to get a script to add up tips during a stream. I have provided an example tip msg where "*Thanks, dude*" will trigger the remote and I am looking on capturing the amount of the current tip and adding it to the current total and then displaying the total to the channel. However because the viewer name can have spaces I am trying to get the tip amount directly to the left of the triggering phrase in this case $100.00 but I have to remove the $ to avoid errors in the variable math. Any help would be greatly appreciated as I am not very knowledgeable in scripting currently.

Example tip: Wow! <viewer name can have spaces in it> just tipped $100.00. Thanks, dude!

My current attempt:

on *:TEXT:*Thanks, dude*:#channel: {
var %message = $1-
/echo Line 1 %message
var %thanksPos = $findtok(%message, Thanks, 1, 32)
/echo Line 2 %thanksPos
if (%thanksPos > 0) {
var %output = $left(%message, %thanksPos - 1)
/echo Line 3 %output
/msg #Channel $1 tipped %output
//set %TipsTotal $calc(%TipsTotal + ($remove(%output,$))%output)
//msg #Channel Tip: The new total is %TipsTotal
}
}

Joined: Jan 2012
Posts: 323
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 323
If I understood the translation of your idea correctly, then try using this script code:
Code
on *:TEXT:*Thanks, dude*:#test:{

  ;Store the username into a variable using $2 and $3 word tokens separated by spaces
  var %name $2-3

  ;Find the token with the "$" character, separate the digit to the left of the first dot, remove the "$" character and store the value in a variable
  var %money $remove($gettok($wildtok($1-,*$*,1,32),1,46),$)

  if (%name && %money) {

    ;Add the total amount of money with the received amount of money
    %tips_total = $calc(%tips_total + %money)

    ;Outputting the result to the channel
    msg $chan Username: %name , Added money: $+($,%money)
    msg $chan Total amount of money: $+($,%tips_total)
  }
}

You can edit and change this code according to your needs.

An example with entering the following text: Wow! Alex Muchaches just tipped $123.00. Thanks, dude!

     [Linked Image from i.ibb.co]


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Aug 2014
Posts: 5
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Aug 2014
Posts: 5
This worked perfectly, Thank you so very much!


Link Copied to Clipboard