bWolfie 139 Posted April 30, 2017 I have a script command which fetches a character's name from the .@atcmd_parameters$[] and displays them in a message. How do I get them to display in one line? Currently I can only get them to display if I print it one line at a time (using message()) - script Print Names FAKE_NPC,{ end; OnCommand: // If user inputs no parameters (i.e. character name) if (!.@atcmd_numparameters) { message(strcharinfo(PC_NAME), "Usage: @printname <name of player to print>"); message(strcharinfo(PC_NAME), "@printname failed."); end; } .@size = getarraysize(.@atcmd_parameters$); for (.@i = 0; .@i < .@size; ++.@i) { .@player$[.@i] = .@atcmd_parameters$[.@i]; message(strcharinfo(PC_NAME), "" + .@player$[.@i] + ""); } end; OnInit: bindatcmd("printname", "Print Names::OnCommand", 10 ,96 , true); end; } If I typed @printname John Smith, it would appear like this: John Smith However, I would like it to be on the same line. John Smith Thank you for any help. Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted April 30, 2017 script_commands.txt have a nice example for it - script atcmd_example FAKE_NPC,{ OnInit: bindatcmd("test", strnpcinfo(NPC_NAME_UNIQUE)+"::OnAtcommand"); end; OnAtcommand: // This command expects a character name (that may contain spaces) as // the only parameter. .@name$ = ""; for (.@i = 0; .@i < .@atcmd_numparameters; ++.@i) { .@name$ += (.@i > 0 ? " " : "") + .@atcmd_parameters$[.@i]; } dispbottom("The specified name is: '" + .@name$ + "'"); end; } 1 bWolfie reacted to this Quote Share this post Link to post Share on other sites
0 bWolfie 139 Posted April 30, 2017 Thanks a bunch, Dastgir! Quote Share this post Link to post Share on other sites
I have a script command which fetches a character's name from the .@atcmd_parameters$[] and displays them in a message.
How do I get them to display in one line?
Currently I can only get them to display if I print it one line at a time (using message())
If I typed @printname John Smith, it would appear like this:
However, I would like it to be on the same line.
Thank you for any help.
Share this post
Link to post
Share on other sites