Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Non case-sensitive chat commands?
Re: Non case-sensitive chat commands? [message #367897 is a reply to message #367682] Mon, 19 January 2009 05:10 Go to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma:
General (3 Stars)
In sscanf, %[] means "everything" the '^' character means "except this"

%[^g] would mean everything except 'g' %[\n] means everything except '\n'. You can also combine them, %[^\ngasd] "everything except '\n','g','a','s','d'"

If you don't have the '^' character you can use it to match "specific" characters.
%[abcd] would only match 'a','b','c','d'

%s in sscanf means a word, so it will stop reading when it meets whitespace or a newline. Not sure on the exact characters it actually reads.

scanf returns the number of variables matched, so we want 2 vars out of the string, we use == 2 or >1 to make sure it succeeded.

Lastly, whitespace in the format string means "whitespace" and not a single space.

sscanf("hello world!", "%s %s", hello, world) //fill hello and world
This applies to everything
sscanf("123 321", "%d %d", &i, &u) //123 321

stricmp is non-case sensitive.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Alternative to tiled textures?
Next Topic: Changing FONT in renegade
Goto Forum:
  


Current Time: Thu Dec 19 12:05:06 MST 2024

Total time taken to generate the page: 0.00727 seconds