Jump to content
  • 0

How to add parameter on a custom command ??


Eross

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.10
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

Hi im trying to create a custom command using bindatcmd .. How to make it like @navto <character name> ???? Thankyou in advance !

Quote

-    script    unit_walk    -1,{
OnInit:
bindatcmd("navto","unit_walk::OnNavigate");
end;

OnNavigate:    
        atcommand "@navto " +.@atcmd_parameters$[0];
    if (isloggedin(getcharid(0,.@atcmd_parameters$[0])) != 1) { message strcharinfo(0), "Target player is offline or do not exist."; }
    sleep2 1; 
    unitwalkto getcharid(3),getcharid(3,.@atcmd_parameters$[0]);
}

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  662
  • Reputation:   671
  • Joined:  11/12/12
  • Last Seen:  

Well you can get the full command used with something like:

OnNavigate:
	.@cmd$ = implode(.@atcmd_parameters$, " ");

	if (isloggedin(getcharid(3, .@cmd$)) != 1) {
		message strcharinfo(0), "Target player '" + .@cmd$ + "' is offline or do not exist.";
	}

	sleep2 1;
	unitwalkto getcharid(3), getcharid(3, .@cmd$);
	end;

Though, unitwalkto is very limited and will most likely fail in most scenarios.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

@atcmd_parameters$[0] = @navto 
@atcmd_parameters$[1] = strcharinfo(0)

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.10
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

15 hours ago, BeWan said:

@atcmd_parameters$[0] = @navto 
@atcmd_parameters$[1] = strcharinfo(0)

What if character has more spaces on name ?? first parameter I think only goes in first name like ex: BLOOD ... but the 2nd goes to BATH so thats 1st and 2nd parameter BLOOD BATH ... what if theres a player whos name is like "O O O O O O" ??? 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

1 minute ago, Origami said:

What if character has more spaces on name ?? first parameter I think only goes in first name like ex: BLOOD ... but the 2nd goes to BATH so thats 1st and 2nd parameter BLOOD BATH ... what if theres a player whos name is like "O O O O O O" ??? 

make a condition.

if player enter the name correct, convert the name into charid

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.10
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

On 5/27/2021 at 9:51 PM, BeWan said:

make a condition.

if player enter the name correct, convert the name into charid

Okay thankyou sir ! very helpful ! Cheers

 

On 5/27/2021 at 10:40 PM, Tokei said:

Well you can get the full command used with something like:


OnNavigate:
	.@cmd$ = implode(.@atcmd_parameters$, " ");

	if (isloggedin(getcharid(3, .@cmd$)) != 1) {
		message strcharinfo(0), "Target player '" + .@cmd$ + "' is offline or do not exist.";
	}

	sleep2 1;
	unitwalkto getcharid(3), getcharid(3, .@cmd$);
	end;

Though, unitwalkto is very limited and will most likely fail in most scenarios.

omg thankyou so much sir !!!! 

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...