Command Alias for a /shrug command

Discussion in 'CommandHelper' started by Column01, Oct 30, 2018.

  1. Column01

    Column01 New Member

    Bare with me because I am new to CommandHelper.
    I am trying to make command helper script in order to turn /shrug into the copy paste shrug: ¯\_(ツ)_/¯
    The script I have so far is this:

    /shrug = >>>
    $shrug = '¯\_(ツ)_/¯'
    run('/sudo' player() say $shrug);
    <<<

    When I run the reloadaliases command, it errors out with this message in the console:
    [​IMG]

    I believe it is because the copy paste has a back slash in it, but I have a feeling that it would also error out because there is also another slash in it too. I tried by defining the string above as well and alas, the error line it indicates moves to the line where I define it. Any help would be appreciated.
  2. Column01

    Column01 New Member

    First off: I was putting it into the wrong file. Second off, I also needed to add another backslash to the shrug to fix the error above.
    So I have refined it to this now

    /shrug = >>>
    $shrug = '¯\\_(ツ)_/¯'
    run('/sudo '.player().'say ' $shrug);
    <<<
    but now I am now stuck with a new error:
    [​IMG]
  3. PseudoKnight

    PseudoKnight Well-Known Member Developer

    A $var with a dollar sign cannot be assigned a new value. These are only used as command inputs (though they can have default values defined in the alias definition; thus the confusion). A @var with an "at" symbol can be assigned a value, what methodscript calls an "ivariable".

    PHP:

    @shrug = '¯\\_(ツ)_/¯';
    run('/sudo '.player().' say '[email protected]shrug);
     
    or more simply:
    PHP:

    @shrug = '¯\\_(ツ)_/¯';
    chat(@shrug);
     
  4. Column01

    Column01 New Member

    Thank you so much @PseudoKnight, The script now works thanks to you :D
    This will help me with all kinds of scripts in the future. You're awesome :D