The online racing simulator
Help with ! commands
(8 posts, started )
Help with ! commands
Hey,
I'm quite new to InSim programming, and I was wondering if anyone could help with ! commands with InSim?

I'm using DarkTime's InSimDotNet library and I'm coding in C#. I'm not sure if I'd do a "switch" case, or what I do.

Help would be appreciated Smile
#2 - Racon
A switch is perfect. I watch MSOs for a first character of '!' and if found, grab the command, break the message at the next space for parameters and switch on the command.
Okay, cheers for replying :-) I'll try it when I'm back at home.
Works a charm! Thanks for your help
Just a question. If I made a !kick <username> command, how would I go about this, as some users have spaces in their names, so how would I get InSim to handle everything after !kick as a username, instead of individual words?
something like this:
string fullText = "!kick Romain Grosjean";
string driverName = fullText.Substring(fullText.IndexOf(' ') + 1);

Or maybe instead of the screen-name you can use the lfs-account-name? I think those never have spaces.
LFS usernames can have spaces. Nevertheless, I adapted the code for usernames and it worked Smile Cheers for your help
#8 - Racon
Spaces in usernames... Uh-hu Ya right ( Taped Shut Wink )

So far I have only needed usernames for commands with no other parameters, so I can just use the whole parameter string without having to deal with any of the messiness. If I need any more parameters in the future, I plan to use a fixed number and have the username always be last so I can do the same thing - but that will likely make my syntax sound clunky, and doesn't let me allow flexibility with parameters.

Help with ! commands
(8 posts, started )
FGED GREDG RDFGDR GSFDG