Remote script with $findtok - 17/01/24 05:32 AM
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
}
}
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
}
}