klesler Posted April 30, 2018 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 46 Reputation: 1 Joined: 03/04/17 Last Seen: December 21, 2020 Share Posted April 30, 2018 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. Quote Link to comment Share on other sites More sharing options...
1 pajodex Posted May 1, 2018 Group: Members Topic Count: 78 Topics Per Day: 0.03 Content Count: 436 Reputation: 167 Joined: 12/12/17 Last Seen: Sunday at 04:46 PM Share Posted May 1, 2018 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$ Quote Link to comment Share on other sites More sharing options...
2 AnnieRuru Posted May 1, 2018 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted May 1, 2018 (edited) input .@PlayerSpecInputName$; .@ownName$ = strcharinfo(0); if (compare(.@PlayerSpecInputName$, .@ownName$) && compare(.@ownName$, .@PlayerSpecInputName$)) { mes "You cant use your own name"; close; } Edited May 1, 2018 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
0 klesler Posted May 1, 2018 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 46 Reputation: 1 Joined: 03/04/17 Last Seen: December 21, 2020 Author Share Posted May 1, 2018 (edited) 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 May 1, 2018 by klesler grammar Quote Link to comment Share on other sites More sharing options...
1 pajodex Posted May 1, 2018 Group: Members Topic Count: 78 Topics Per Day: 0.03 Content Count: 436 Reputation: 167 Joined: 12/12/17 Last Seen: Sunday at 04:46 PM Share Posted May 1, 2018 (edited) 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 May 1, 2018 by pajodex Quote Link to comment Share on other sites More sharing options...
0 klesler Posted May 1, 2018 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 46 Reputation: 1 Joined: 03/04/17 Last Seen: December 21, 2020 Author Share Posted May 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
Question
klesler
Hi rAthena!
I'm trying to compare an input with rid2name(getcharid(3))
E.g
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.