Jump to content
  • 0

How to deal with case sensitive ?


klesler

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  46
  • Reputation:   1
  • Joined:  03/04/17
  • Last Seen:  

Hi rAthena!

I'm trying to compare an input with rid2name(getcharid(3))

E.g

input @PlayerSpecInputName$;

set .@ownName$,( rid2name(getcharid(3)) );
	if( @PlayerSpecInputName$ == .@ownName$ ) {
		mes "You cant use your own name";
		close;

But the logic is only working if the player input his own name exactly how it is written (case-sensitive),

ex: If a player nick is 'XxXExAmPLE' and he inputs 'xxxexample', my if ( @PlayerSpecInputName$ == .@ownName$ ) wont work properly.

Does anybody know how to overcome that ?

Thanks in advance! ?

Best,
Gabriel.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 2

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

    input .@PlayerSpecInputName$;
    .@ownName$ = strcharinfo(0);
    if (compare(.@PlayerSpecInputName$, .@ownName$) && compare(.@ownName$, .@PlayerSpecInputName$)) {
        mes "You cant use your own name";
        close;
    }

 

Edited by AnnieRuru
Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

2 hours ago, klesler said:

Hi rAthena!

I'm trying to compare an input with rid2name(getcharid(3))

E.g


input @PlayerSpecInputName$;

set .@ownName$,( rid2name(getcharid(3)) );
	if( @PlayerSpecInputName$ == .@ownName$ ) {
		mes "You cant use your own name";
		close;

But the logic is only working if the player input his own name exactly how it is written (case-sensitive),

ex: If a player nick is 'XxXExAmPLE' and he inputs 'xxxexample', my if ( @PlayerSpecInputName$ == .@ownName$ ) wont work properly.

Does anybody know how to overcome that ?

Thanks in advance! ?

Best,
Gabriel.

You can do something like 

if ( .@PlayerSpecInputName$ == strcharinfo(0) ) {
  	mes "Mehh your using your name";
  	close;
  }

 

PS: I don't know if you intentionally use @PlayerSpecInputName$ which is a temporary variable attach to player? or is this a typo? Anyways, I used .@PlayerSpecInputName$ 
 

 

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

11 minutes ago, klesler said:

Thank you for the quick answer guys! @AnnieRuru, @pajodex

I was using .@ before, but then I tried to use @ (thinking it was a global variable) to solve a problem.

I mean, I started a timer with initnpctimer; inside an event called proceed, then I stop this timer on the next event (N_paying) or if the timer reach 15000 (15 seconds) e.g:


Proceed:
    initnpctimer;
	goto N_paying;
end;

N_paying:
  stopnpctimer;
end;

OnTimer15000:
	stopnpctimer;
	attachrid( @PlayerSpecID );
	mes "The player is AFK or has disconnected...";
  	close2;
	attachrid( getcharid(3,@PlayerSpecInputName$) );
	close;
end;

But the attachrid( .@PlayerSpecID ); and attachrid( getcharid(3,.@PlayerSpecInputName$) ); inside OnTimer15000: was not working, the console was telling me that the player was not attached, then I changed from .@ to @ in order to solve that (I thought it was a scope thing), but it didn't work too HAhaha!

If you know how to overcome that too, I would really appreciate it! ? 

Thanks!
Gabriel.

You can use checkidle(); instead.. see how this is  scripted..

Just read https://github.com/rathena/rathena/blob/master/doc/script_commands.txt

You can see all alternative codes that you might need.. or ask here in forum..

 

As for variables... read these examples..

Examples:
  name  - permanent character integer variable
  name$ - permanent character string variable
 @name  - temporary character integer variable
 @name$ - temporary character string variable
 $name  - permanent global integer variable
 $name$ - permanent global string variable
$@name  - temporary global integer variable
$@name$ - temporary global string variable
 .name  - NPC integer variable
 .name$ - NPC string variable
.@name  - scope integer variable
.@name$ - scope string variable
 'name  - instance integer variable
 'name$ - instance string variable
 #name  - permanent local account integer variable
 #name$ - permanent local account string variable
##name  - permanent global account integer variable
##name$ - permanent global account string variable

 

Edited by pajodex
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  46
  • Reputation:   1
  • Joined:  03/04/17
  • Last Seen:  

Thank you for the quick answer guys! @AnnieRuru, @pajodex

I was using .@ before, but then I tried to use @ (thinking it was a global variable) to solve a problem.

I mean, I started a timer with initnpctimer; inside an event called proceed, then I stop this timer on the next event (N_paying) or if the timer reach 15000 (15 seconds) e.g:

Proceed:
    initnpctimer;
	goto N_paying;
end;

N_paying:
  stopnpctimer;
end;

OnTimer15000:
	stopnpctimer;
	attachrid( @PlayerSpecID );
	mes "The player is AFK or has disconnected...";
  	close2;
	attachrid( getcharid(3,@PlayerSpecInputName$) );
	close;
end;

But the

attachrid (.@PlayerSpecID );

and

attachrid( getcharid(3,.@PlayerSpecInputName$) );

inside

OnTimer15000:

was not working, the console was telling me that the player was not attached, then I changed from

.@

to

@

in order to solve that (I thought it was a scope thing), but it didn't work too HAhaha!

If you know how to overcome that too, I would really appreciate it! ? 

Thanks!
Gabriel.

Edited by klesler
grammar
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  46
  • Reputation:   1
  • Joined:  03/04/17
  • Last Seen:  

Hmmm, @pajodex

Seems interesting, but maybe wont cover all the scenarios of what I'm trying to do, if you are interested: 

 

Anyway I'll try to solve all my scenarios with checkidle();

Thanks buddy! ?

Best,
Gabriel.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...