Author Topic: Making a counting bot for discord  (Read 1171 times)

Conclavice

  • Newbie
  • *
  • Posts: 10
  • All Hail Pfiel
Making a counting bot for discord
« on: April 19, 2021, 11:45:40 AM »
so i have the first bit done, it asks for 2 inputs, the starting number and how many times to count, I have the loop set up for the second input but I'm not sure how I would add one to the number on the clipboard each time

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4758
  • RTFM
Re: Making a counting bot for discord
« Reply #1 on: April 19, 2021, 11:52:08 AM »
What does your command actually look like? Right-click the action list, choose "Copy All as Text" from the context menu, then paste here into a code block (click the # button)

Conclavice

  • Newbie
  • *
  • Posts: 10
  • All Hail Pfiel
Re: Making a counting bot for discord
« Reply #2 on: April 19, 2021, 12:10:32 PM »
What does your command actually look like? Right-click the action list, choose "Copy All as Text" from the context menu, then paste here into a code block (click the # button)

Get Integer Input [starting]
Get Integer Input [number]
Start Loop : Repeat [{number}] Times
End Loop

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4758
  • RTFM
Re: Making a counting bot for discord
« Reply #3 on: April 19, 2021, 12:32:20 PM »
Have you read the documentation on tokens? "{number}" is not a valid token. Adding curly braces around a variable name does not make it a token.

The loop will iterate because the token parser strips the braces, and the remaining text ("number") happens to be a valid integer variable name, so that's the action coincidentally working despite the invalid input.


Assuming you want the command to sequentially paste each number:

To have the loop do the counting for you, you'll likely want to use the "Range (For Loop)" option, so you can get the output from the indexer variable to paste (or type)

For that you'll need to add the amount you want to count up by to the starting number, to use as the second parameter (in the "To" field)

E.G.
Code: [Select]
Get Integer Input [starting]
Get Integer Input [number]
Set integer [target] value to the value of [starting]
Set integer [target] to [target] plus [number]
Start Loop : Repeat From [starting] to [target], using indexer [output]
    Set Windows clipboard to '{INT:output}'
    Press Left Ctrl+V keys and hold for 0,01 seconds and release
    Press Enter key and hold for 0,01 seconds and release
End Loop