Openkore.com

OpenKore Forums
It is currently 08 Dec 2019, 10:14

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: How can I get chat room player name?
PostPosted: 10 Apr 2017, 15:51 
Offline
Noob
Noob

Joined: 15 Feb 2016, 02:09
Posts: 13
I want to get player real name in chat.
I used command "chat info" to catch it.

Code:
[list] -----------Chat Room Info-----------
Title                     Users   Public/Private
[list]                           2/      Private
[list] -- Users --
[list] 0   test°                       
[list] 1   mo mo                     


Question 1:
Behind name had many space.
name + space = 27 Character

Question 2:
If player name had space?
example name:mo mo



my test macro
Code:
automacro test1 {
   pubm /game start/i
        call {
           do chat info

        }
}
automacro test2 {
   console /0\ \ \ \ (.*)\ \[(.*)\](.*)\((\d+)\, (\d+)\)/i
        exclusive 1
        call {
           do pm '$.lastMatch1' 123

        }
}


How can I get real name to pm?
maybe should modify message TF source code, let surplus space do not show?
Thank you~


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 11 Apr 2017, 01:15 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
Data is stored in global. So to get first man in chat room:

Code:
@eval($::currentChatRoomUsers[0])

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 11 Apr 2017, 05:45 
Offline
Noob
Noob

Joined: 15 Feb 2016, 02:09
Posts: 13
Mortimal wrote:
Data is stored in global. So to get first man in chat room:

Code:
@eval($::currentChatRoomUsers[0])


It's worked!
Thank you!! :D

But I have a little problem

example
Code:
           
$chatnumber = 0
while ($chatnumber < 20)as loop
   $chatnumber++

   $player$chatnumber = @eval($::currentChatRoomUsers[$chatnumber])

end loop



$player$chatnumber is wrong
I tried
Code:
$player$chatnumber
'$player$chatnumber'
"$player$chatnumber"
$player'$chatnumber'
$player"$chatnumber"
$player+$chatnumber
$player+"$chatnumber"
$player+'$chatnumber'
$player $chatnumber

have other method can use varible on varible-name?

Thank you very much!


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 11 Apr 2017, 07:16 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
Gets list of users in chatroom(maybe xD ) stores it in $s:
Code:
$s = @eval(print "@::currentChatRoomUsers")


Gets n user from list $s:
Code:
@arg ("$s", n)


Output list of users in chatroom:
Code:
$s = @eval(print "@::currentChatRoomUsers")
$chatnumber = 0
while ($chatnumber < 20) as loop
   $chatnumber++
   log @arg ("$s", $chatnumber)
end loop


try that... i dont know what your aim is so -_-

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 11 Apr 2017, 08:27 
Offline
Noob
Noob

Joined: 15 Feb 2016, 02:09
Posts: 13
Mortimal wrote:
Gets list of users in chatroom(maybe xD ) stores it in $s:
Code:
$s = @eval(print "@::currentChatRoomUsers")


Gets n user from list $s:
Code:
@arg ("$s", n)


Output list of users in chatroom:
Code:
$s = @eval(print "@::currentChatRoomUsers")
$chatnumber = 0
while ($chatnumber < 20) as loop
   $chatnumber++
   log @arg ("$s", $chatnumber)
end loop


try that... i dont know what your aim is so -_-




:D :D
thank you a lot :lol:


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 13 Apr 2017, 14:19 
Offline
Noob
Noob

Joined: 15 Feb 2016, 02:09
Posts: 13
Mortimal wrote:
try that... i dont know what your aim is so -_-


hello
I have got a little problem@@
although I got the player name and set to varible $player1

If the player name only have number
example:
Code:
$player1 = 321654
do pm "$player1" test


always got error message
Code:
Quick look-up 321654 not exist


because :(
<pm list #>
- a corresponding number from the pm list when you use the pml command.

I tried always error
Code:
"$.lastpm"
$.lastpm
'$.lastpm'
"$player1"
$player1
'$player1'


how can I pm to a number man?
thank you~


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 13 Apr 2017, 15:41 
Offline
Developers
Developers

Joined: 01 Nov 2008, 15:31
Posts: 391
w8 il look up for this in souce code

.....

ok we got bug here..... fixing

.....

src/Commands.pm line 4137
replace:
Code:
   } elsif ($user =~ /^\d+$/) {

with:
Code:
   } elsif ($user =~ /^[^"]{1}\d+[^"]{1}$/) {

add before line 4152:
Code:
$user =~ s/^\"(.*)\"$/\1/;


my pull request https://github.com/OpenKore/openkore/pull/550/files

Now will work:
Code:
pm "1234434" Hello World!

_________________
Please use pin function for uploading your file contents!


Top
 Profile  
 
 Post subject: Re: How can I get chat room player name?
PostPosted: 14 Apr 2017, 04:05 
Offline
Noob
Noob

Joined: 15 Feb 2016, 02:09
Posts: 13
Mortimal wrote:
Code:
$user =~ s/^\"(.*)\"$/\1/;


my pull request https://github.com/OpenKore/openkore/pull/550/files


Thank you, but your line-4152 code had two version?
Code:
in here:
$user =~ s/^\"(.*)\"$/\1/;

in github:
$user =~ s/^\"(.*)\"$/$1/;


I download your github openkore
then I tried both version,but still Quick look-up 321654 does not exist :(
pm "321654" hello


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group