Page 1 of 1
How can I get chat room player name?
Posted: 10 Apr 2017, 15:51
by bluesky
I want to get player real name in chat.
I used command "chat info" to catch it.
Code: Select all
[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: Select all
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~
Re: How can I get chat room player name?
Posted: 11 Apr 2017, 01:15
by Mortimal
Data is stored in global. So to get first man in chat room:
Re: How can I get chat room player name?
Posted: 11 Apr 2017, 05:45
by bluesky
Mortimal wrote:Data is stored in global. So to get first man in chat room:
It's worked!
Thank you!!
But I have a little problem
example
Code: Select all
$chatnumber = 0
while ($chatnumber < 20)as loop
$chatnumber++
$player$chatnumber = @eval($::currentChatRoomUsers[$chatnumber])
end loop
$player$chatnumber is wrong
I tried
Code: Select all
$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!
Re: How can I get chat room player name?
Posted: 11 Apr 2017, 07:16
by Mortimal
Gets list of users in chatroom(maybe xD ) stores it in $s:
Code: Select all
$s = @eval(print "@::currentChatRoomUsers")
Gets
n user from list $s:
Output list of users in chatroom:
Code: Select all
$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 -_-
Re: How can I get chat room player name?
Posted: 11 Apr 2017, 08:27
by bluesky
Mortimal wrote:Gets list of users in chatroom(maybe xD ) stores it in $s:
Code: Select all
$s = @eval(print "@::currentChatRoomUsers")
Gets
n user from list $s:
Output list of users in chatroom:
Code: Select all
$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 -_-
thank you a lot
Re: How can I get chat room player name?
Posted: 13 Apr 2017, 14:19
by bluesky
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: Select all
$player1 = 321654
do pm "$player1" test
always got error message
because
<pm list #>
- a corresponding number from the pm list when you use the pml command.
I tried always error
Code: Select all
"$.lastpm"
$.lastpm
'$.lastpm'
"$player1"
$player1
'$player1'
how can I pm to a number man?
thank you~
Re: How can I get chat room player name?
Posted: 13 Apr 2017, 15:41
by Mortimal
w8 il look up for this in souce code
.....
ok we got bug here..... fixing
.....
src/Commands.pm line 4137
replace:
with:
Code: Select all
} elsif ($user =~ /^[^"]{1}\d+[^"]{1}$/) {
add before line 4152:
my pull request
https://github.com/OpenKore/openkore/pull/550/files
Now will work:
Re: How can I get chat room player name?
Posted: 14 Apr 2017, 04:05
by bluesky
Thank you, but your line-4152 code had two version?
Code: Select all
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