Room Commands

Results 1 to 16 of 16
  1. #1
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Room Commands

    im using sscanf for roomcommands but i cant use it twice in 1 room name why is that only 1 command will work when i do it in the roomname :

    [gra=10000][zib=100000]

    and only the command gra will work.

    if i use [zib=100000] it just work

    and normal commands with strstr just work with multi command

    [HOOFD][VLIEG][MOGOOL]

    how do i fix that.


  2. #2
    Apprentice Ofek Ohayon is offline
    MemberRank
    Jun 2012 Join Date
    9Posts

    Re: Room Commands

    u want Runbble with Command ?

  3. #3
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: Room Commands

    Quote Originally Posted by Ofek Ohayon View Post
    u want Runbble with Command ?
    uh no? i want to fix that problem ...

  4. #4
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Room Commands

    Use sscanf with multiple identifiers? (And use the safe version)

    Example:
    PHP Code:
    int nGranZib;
    sscanf_s(szStageName"[gra=%i][zib]%i]", &nGra, &nZib); 
    http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx

  5. #5
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: Room Commands

    Quote Originally Posted by Wizkidje View Post
    Use sscanf with multiple identifiers? (And use the safe version)

    Example:
    PHP Code:
    int nGranZib;
    sscanf_s(szStageName"[gra=%i][zib]%i]", &nGra, &nZib); 
    sscanf_s, _sscanf_s_l, swscanf_s, _swscanf_s_l (CRT)
    they need to be separated but when you put them both in a gameroom they both need to work they dont if you use sscanf
    and if you use strstr it works with both
    sscanf(ZGetGameClient()->GetStageName(), "[Gra=%i]", &newgra);
    sscanf(ZGetGameClient()->GetStageName(), "[zib=%i]", &newzib);

    ingame roomname:
    [gra=120][zib=1337]

    and it wont work only if use strstr but i dont know how to get a value from the roomname with strstr

  6. #6
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Room Commands

    Quote Originally Posted by Mocro View Post
    and it wont work only if use strstr but i dont know how to get a value from the roomname with strstr
    You can't do with strstr, because it scans string, and the only you wrote like [G], it won't work if you use [g], anyway use multiple, i had this problem and used that...

  7. #7
    Account Upgraded | Title Enabled! CobraBite is offline
    MemberRank
    Jan 2011 Join Date
    Where?Location
    281Posts

    Re: Room Commands

    Spread them. Don't make them in one, or use the wizkid method.
    Edit: My bad, didn't read your last post XD

  8. #8
    Proficient Member Mr_Troy is offline
    MemberRank
    Jun 2007 Join Date
    172Posts

    Re: Room Commands

    Use C++ strings.

  9. #9
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Room Commands

    Quote Originally Posted by Mr_Troy View Post
    Use C++ strings.
    But he want to scan value?

  10. #10
    Proficient Member Mr_Troy is offline
    MemberRank
    Jun 2007 Join Date
    172Posts

    Re: Room Commands

    Quote Originally Posted by qet123 View Post
    But he want to scan value?
    Which can be done easily with C++ strings...

  11. #11
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: Room Commands

    Quote Originally Posted by Mr_Troy View Post
    Which can be done easily with C++ strings...
    example would be nice.

  12. #12
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Room Commands

    Quote Originally Posted by Mr_Troy View Post
    Which can be done easily with C++ strings...
    Going for what he said

    Quote Originally Posted by Mocro View Post
    example would be nice.
    Here what I done for scan gravity value:
    Code:
    void ZModule_Movable::UpdateGravity(float fDelta)
    {
    	string name = (string)ZGetGameClient()->GetStageName();
    
    	if((name.find("[G=") != string::npos) && (name.find("]") != string::npos))	
    	{	
    		int fGravity;	
    		sscanf(name.c_str(), "[G=%d]", &fGravity);	
    		if(fGravity > 0)	
    			m_Velocity.z = max( m_Velocity.z - fGravity*fDelta,-MAX_FALL_SPEED);
    	}	
    	else
    		m_Velocity.z = max( m_Velocity.z - GRAVITY_CONSTANT*fDelta,-MAX_FALL_SPEED);
    }

  13. #13
    Proficient Member Mr_Troy is offline
    MemberRank
    Jun 2007 Join Date
    172Posts

    Re: Room Commands

    Quote Originally Posted by qet123 View Post
    Going for what he said


    Here what I done for scan gravity value:
    Code:
    void ZModule_Movable::UpdateGravity(float fDelta)
    {
        string name = (string)ZGetGameClient()->GetStageName();
    
        if((name.find("[G=") != string::npos) && (name.find("]") != string::npos))    
        {    
            int fGravity;    
            sscanf(name.c_str(), "[G=%d]", &fGravity);    
            if(fGravity > 0)    
                m_Velocity.z = max( m_Velocity.z - fGravity*fDelta,-MAX_FALL_SPEED);
        }    
        else
            m_Velocity.z = max( m_Velocity.z - GRAVITY_CONSTANT*fDelta,-MAX_FALL_SPEED);
    }
    That would crash when you have a room tag like this : ][G=%d

  14. #14
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Room Commands

    Quote Originally Posted by Mr_Troy View Post
    That would crash when you have a room tag like this : ][G=%d
    well, i can tell you something :
    1. It's not working with more than one sscanf.
    2. Why they hell they will write ][G=5000.
    3. How about helping him / correct my code.

  15. #15
    -- Nayr438 is offline
    MemberRank
    May 2008 Join Date
    241Posts

    Re: Room Commands

    Code:
    if(sscanf_s(szStageName, "[gra=%i] [zib=%i]", &newgra, &newzib)) {
    // ToDo: Add Code Here
    }
    else {
    // ToDo: Add Code Here
    }
    Try to move away from room name tags, aim for stage settings or channel id based modifiers.

    Code:
    void ZModule_Movable::UpdateGravity(float fDelta)
    {
    	int fGravity;
    	string name = (string)ZGetGameClient()->GetStageName();
    
    	if(sscanf(name.c_str(), "[G=%i]", &fGravity)) {	
    		if(fGravity > 0)	
    			m_Velocity.z = max( m_Velocity.z - fGravity*fDelta,-MAX_FALL_SPEED);
    	} else
    		m_Velocity.z = max( m_Velocity.z - GRAVITY_CONSTANT*fDelta,-MAX_FALL_SPEED);
    }
    Last edited by Nayr438; 03-07-12 at 04:55 PM.

  16. #16
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Room Commands

    Quote Originally Posted by Nayr438 View Post
    Code:
    if(sscanf_s(szStageName, "[gra=%i] [zib=%i]", &newgra, &newzib)) {
    // ToDo: Add Code Here
    }
    else {
    // ToDo: Add Code Here
    }
    Try to move away from room name tags, aim for stage settings or channel id based modifiers.

    Code:
    void ZModule_Movable::UpdateGravity(float fDelta)
    {
    	int fGravity;
    	string name = (string)ZGetGameClient()->GetStageName();
    
    	if(sscanf(name.c_str(), "[G=%i]", &fGravity)) {	
    		if(fGravity > 0)	
    			m_Velocity.z = max( m_Velocity.z - fGravity*fDelta,-MAX_FALL_SPEED);
    	} else
    		m_Velocity.z = max( m_Velocity.z - GRAVITY_CONSTANT*fDelta,-MAX_FALL_SPEED);
    }
    you didn't changed anything lol, we know the [G=%i] method, but still won't scan more than 1 tag and he doesn't want to put more than one tag in sscanf, he wants them alone.



Advertisement