Jump to content
  • 0

Help Needed: Script Error with atcommand


catanata

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  06/16/24
  • Last Seen:  

I am encountering a script error while trying to use the atcommand function in my summon_monsters.txt script. The script is intended to summon monsters using a custom command. However, I receive the following error after reloading the script:
 

function script summon_monsters {
    .@mob_id = getarg(0);
    .@qty = getarg(1);

    if (.@mob_id > 0 && .@qty > 0) {
        .@command$ = "@summony " + .@mob_id + " " + .@qty;
        atcommand(.@command$, getcharid(3));
    }
}

and error after reload

script error on npc/custom/summonmonsters.txt line 7
    parse_callfunc: expected ')' to close argument list
     2 :     .@mob_id = getarg(0);
     3 :     .@qty = getarg(1);
     4 :
     5 :     if (.@mob_id > 0 && .@qty > 0) {
     6 :         .@command$ = "@summony " + .@mob_id + " " + .@qty;
*    7 :         atcommand(.@command$, getcharid(3));
     8 :     }
     9 : }

Could someone please help me identify what might be causing this error and how to resolve it? Any suggestions or insights would be greatly appreciated!

Thank you in advance!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   94
  • Joined:  06/02/12
  • Last Seen:  

atcommand "<command>";

Hi, atcommand has no parameter for char/account ID.

Find:

        .@command$ = "@summony " + .@mob_id + " " + .@qty;
        atcommand(.@command$, getcharid(3));

Replace:

        .@command$ = "@summony " + .@mob_id + " " + .@qty + " " + getcharid(3);
        atcommand(.@command$);

 

Edited by Racaae
fix formatting
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  06/16/24
  • Last Seen:  

On 7/3/2024 at 6:26 AM, Racaae said:
atcommand "<command>";

Hi, atcommand has no parameter for char/account ID.

Find:

        .@command$ = "@summony " + .@mob_id + " " + .@qty;
        atcommand(.@command$, getcharid(3));

Replace:

        .@command$ = "@summony " + .@mob_id + " " + .@qty + " " + getcharid(3);
        atcommand(.@command$);

 

Thank you so much for you correction , my problem was solved now. have a great day 🙂

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...