Forums » Community Projects

help with the "Prompt" command and aliases

Oct 08, 2017 Luxen link
So, I am trying to set up an alias that lets me just /greet <pilot name> and the output is in channel 1 "Welcome to Vendetta Online, <pilot name>!". So far, I thought it would be along the lines of

join 1;
say_channel <message>;
join 100;

But to get a pilot's name in there would require the prompt command. how does the prompt command work? would I be able to add it to this the way I am thinking? Or would it become a multi output line mess?

I can always squish together a lua plugin if I absolutely have to, but if I can do this with an alias, I'd prefer that.
Oct 09, 2017 yodaofborg link
Prompt works like so

/prompt "echo"

will open a chat box with the command /echo already present and wait for the rest of the input. so in theory you could use /prompt "say_channel 'Welcome to Vendetta, ' " which will open a box for you to type the pilots name.


I'm not sure if you need to add a / before the command after prompt and am not able to login to test, but it should be able to do what you require.
Oct 09, 2017 draugath link
None of the game commands contain slashes (/). The singular slash used when manually typing commands is merely an escape character which tells the chat processor that what follows is a string of commands.
Oct 09, 2017 Luxen link
So /alias greet "join 1; prompt say_channel Welcome to Vendetta Online, ; say_channel Let me know if I can answer a question for you!; join 100"
Oct 09, 2017 Luxen link
Nope, nvm. The entire alias is exectued at once, but prompt waits for user input, forcing join 100 to run before prompt returns. Ill just have to try making a command with lua to combine strings and shares it.

How do you switch channels in lua?
Oct 10, 2017 genka link

SendChat takes three parameters. According to the wiki, when the second parameter is "CHANNEL", the third controls which channel the message goes to. So, you would want to do something like
SendChat("You suck, " .. name, "CHANNEL", 1)

I don't know if it actually changes the channel (so you have to change it back) or if it just sends the message to the channel in qustion. I don't even know if the function does what the wiki thinks it does. You might have to do something we in the biz like to call "try it out for yourself" to find out.
Good luck!
Oct 10, 2017 draugath link
It doesn't change the channel and will only send to channels that you are joined to. Also keep in mind that the 2nd argument is a string and must be in quotes if you use a literal value.
Oct 10, 2017 Darth Nihilus link
I stick this kinda crap in a plugin cause I dont trust the wgaf file. This is how I would do it (someone will inevitably shit on me):

gkinterface.GKProcessCommand("alias helpalias 'say_channel Welcome to Vendetta Online! Let me know if I can answer a question for you!'")
gkinterface.GKProcessCommand("alias usablehelpalias helpalias")
gkinterface.GKProcessCommand("alias helpbind 'join 1; usablehelpalias; join 100'")

Then you can bind helpbind to whatever. This was tested and worked for me. But there may be a better way of doing it.


Sorry, did I misunderstand? Is the adding of the name the part you're looking for more information on?
Oct 10, 2017 Luxen link
Nihilus, i could shove a join/say_channel/join together, the problem is when I add a prompt command.

Thanks, genka and dragauth! Thats exactly what I needed. Ill slap something together and see what I mess up on, or figure out the next thing I wanna do.
Oct 15, 2017 yodaofborg link
Yeah, /prompt does not cause a wait loop, so any commands following it will be executed in order, regardless of the /prompt dialogue firing. The best you can do with the command line is probably /prompt say_help "blah blah " or use a manual wait timer.

say_help at least takes you to channel 1. but does not return you to last active channel after. In fact the only command that would work is /help (it is just a function of the Lua command above), and you cannot alias that as it brings up the help menu if typed solo, and sends to 1 only if with a string passed and an alias seems to trigger the first option regardless. It would be the best option if the devs fixed that to be honest, then you could just /prompt help "string", as this at least does not throw you on 100 - maybe you were on 444 before hand - you TGFT sympathiser you ;).


Darth, the problem is not getting the name, it is getting the prompt dialog to return to 100 after Luxen types the pilots name and sends the message to 1. AFAIK, it would be impossible to get the pilots name from chat for this purpose. Feel free to prove me wrong :)
Oct 15, 2017 Luxen link
Yoda, this fixed it:

declare('lxtool', lxtool or {})

function lxtool.greet(_, data)
local str = ""
if not data then
str = "Welcome to Vendetta Online! If you have any questions, feel free to ask here!", "CHANNEL", "1"
str = "Welcome to Vendetta Online, " .. tostring(data[1]) .. "!"
SendChat(str, "CHANNEL", "1")

RegisterUserCommand("greet", lxtool.greet)
May 05, 2018 Nyscersul link
Why not write a simple event handler?

You could, quite easily have something that follows this route automatically. It would watch for new players on 1 and simply send this same automated greeting.

If you like i could rustle up some code...

gimme a shout in game if you want hehe
May 05, 2018 Luxen link
because I don't want it to be automatic; I actually gotta be there to greet, respond, and answer questions. Bots aren't beautiful to new pilots.