I need help using Variables

I want an “on chat” command to read

A total of #

and where # is I want the variable to be so I can put it into an Rcon integration, but I don’t understand how to read the number after a keyword command.

I have the keyword command “A total of”
and I setup my command like normal Rcon, but I don’t know how to make it read that number.

I’m having another bot from ko-fi say “A total of (amount donated here)”

and for every dollar, I want it to adjust that variable.

Rcon command: factorio_kofi
Say a text: $int_rcon(call_template,180,factorio_kofi,{var4}) (this is probably wrong)

Snap 2022-09-29 at 19.56.21
This is how it will appear in chat, I want to pull the number (it can be a whole number it doesn’t need to be a decimal)

If I understand correctly, normally it is like this:

$int_rcon(call_template,180,factorio_kofi,3) A total of 3 meteors were...

Then in the command (action text) of the template “factorio_kofi” on the RCON integration page. You have added the variable {var_1} which will correspond to the number “3” which is indicated on the TAG.

How do I make the 3 a variable defined from an outside source? I don’t want it to always be 3.

Outside source ?, do you have details?

when my viewers tip me at https://ko-fi.com/grishord I can have the amount sent to chat via a message, the above is an example of that message. I can change the message to be ANYTHING so if it needs to be in a different let me know, I just want to be able to use the dollar amount tipped as a variable.

So in the screenshot above, that’s a test notification, which says “so and so has tipped you $3” in that example.

I want to use that 3 as a variable in a command so I can have rcon do something with that variable (in this case specifically, for every dollar they spend, I want it to drop a meteor) the command works, I just don’t know how to have it read the variable so I can change it based off the amount coming from ko-fi

Snap 2022-10-06 at 13.01.46
This is the default message from their bot if it helps (which I can also change)

Sorry for the delay in responding.

For this particular case, I only see the creation of a custom command under the type “Keywords”.

If you can modify the message, try adding a special keyword (e.g. #TIP#).

Create the command that is targeted on this keyword, add the permission “List user” and select the name of your bot to restrict it. From there, get the argument ($arg(x)) that corresponds to the given amount.

I don’t understand how to take the argument, and plug it into the template as a variable to where it sends the variable input, not the thing that calls the argument.

It’s simple:

You have your bot that notifies donations, it sends the following message:

“New tip of XXX from YYY!”

You create a custom command of type “Keyword”, which includes “New tip”.

In permission of this command, you add the permission by user list and you add “KofiStreamBot” in this list so that only the messages of this bot are taken into account.

In command value (action), you then add:


$arg(3) = Corresponds to the 4th word of the message (the zero is counted) / Which returns XXX.

You can go further, using the TAG $(intval,…) which will in your case, transform 3.00 into 3:


And to make a more complete command:

$int_rcon(call_template,180,factorio_kofi,$(intval,$arg(3))) A total of $(intval,$arg(3)) of meteors were spawned thanks to $arg(5)'s donation!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.