getting the player's chat cursor index

Discussion in 'Plugin Development' started by reghzyTheR, Jun 15, 2021.

  1. Offline

    reghzyTheR

    is it possible to get the cursor location/index of the player's chat box? its a textbox, and you can move the cursor's position/index by clicking the text or clicking the left/right arrow keys. but is it possibly to get this using a plugin?

    if not... say the player had typed in "commandname do something with args here", is it possibly to get what word the player's chat cursor/index is over? e.g. if the chat cursor index is 18, i would know its over the word "something"

    im going to be using this in the onTabComplete method (which you get from TabCompleter) as well, thats where im trying to detect if. if its not possilbe... i just have to use the last thing in the arguments (in that example above, i would process "here")
     
  2. Offline

    KarimAKL

    @reghzyTheR No, you cannot get the index directly, but you might be able to get all of the previous arguments, the command name, and the spaces in between arguments, and then use the sum of the length of those.

    Anyway, why do you need this? This seems like an XY problem.
     
  3. Offline

    reghzyTheR

    i making a simple way to add in commands and stuff, and it also lets you handle tab events for a specific commands (without having to constantly manually check the args to see if everything matches, it just does it all for you)

    what would be kinda handy, is if i didn't know what a parameter for a command did, i could just type it out, then press tab over that argument and it would print it on my screen. i can do that currently, but only with the last argument
     
  4. Offline

    KarimAKL

    @reghzyTheR I do not believe that is possible. You can only handle the server-side, after all.
     

Share This Page