Dynamic sensitivity command | Different output per game

HI

i see multiple topic about Dynamic command but i couldnt understand anything + i’m little bad with code stuf sorry for that

what i want is sens command that check 2 thing (game + live state) i don’t know if it posable or not to show live state but when i think of uptime command it’s the same thing
for three examble:

!sens
check live state = online
check game = “game1”
answer = “sens1”

!sens
check live state = online
check game = just chating
answer = sens1 + sens2 + sens3 + sens4

!sens
check live state = ofline
answer = sens1 + sens2 + sens3 + sens4

i have 4 game sens so if some can make the game line repet for for time i’ll be appreciated
Thank you <3

You can get livestate and game by using

$(twitch $(channel) "{{state}} | {{game}}")

and what is sens1, sens2, sens3 ?

is it a command?

i type it so i can replace it with sens of the game
like if the game valorant the answer will be (800 dpi 0.24 sens)
so when the stream is ofline or on just chating it will display all of my sens in every game

Hey @sawex!

Here’s how to make such command:

!addcom !sens $(eval s = ['SENS1', 'SENS2', 'SENS3', 'SENS4']; f = `Here are the various mouse sensitivity settings I use: ${s.join(', ')}`; t = '$(twitch $(channel) "{{status}}|{{game}}")'.split('|'); t[0] === 'offline' ? f : switch (t[1]) {case 'GAME1': s[0]; break; case 'GAME2': s[1]; break; case 'GAME3': s[2]; break; case 'GAME4': s[3]; break; default: f;})

All you have to do now is to replace the various SENS and GAME.


A cleaner way of doing this, which would also allow you to add as many game as you want without having to worry about the command’s character limit, would be to use a JSON with all your mouse sensitivities in there, you could even expand it and add more data/game if you’d like:

  1. Create a JSON file and store it on Pastebin (create an account so you can edit it later):

    {
      "GAME1": {
        "mouse_sensitivity": "SENS1"
      },
      "GAME2": {
        "mouse_sensitivity": "SENS2"
      },
      "GAME3": {
        "mouse_sensitivity": "SENS3"
      },
      "GAME4": {
        "mouse_sensitivity": "SENS4"
      }
    }
    
  2. Then your command’s code would look like this:

    $(eval p = $(urlfetch json https://pastebin.com/raw/XXXXXXXX); s = []; Object.values(p).forEach(k => s.push(k.mouse_sensitivity)); f = `Here are the various mouse sensitivity settings I use: ${s.join(', ')}`; t = '$(twitch $(channel) "{{status}}|{{game}}")'.split('|'); t[0] === 'offline' ? f : p[t[1]] ? p[t[1]].mouse_sensitivity : f;)
    

    You need to replace XXXXXXXX with the paste ID.

2 Likes

Thank you so much i did the JSON method and it worked <3

1 Like

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