[FIXED] Can't trade on realms with '-' in the name
4 posters
Page 1 of 2
Page 1 of 2 • 1, 2
[FIXED] Can't trade on realms with '-' in the name
Long story short, TRP2_ExchangeMonTab["Cible"] at line 997 in totalrp2_invaintaire_main contains the name with a '-' ie player-serverfirst-serverlast, whereas sender in the arguement contains player-serverfirstserverlast
arekku- Posts : 14
Join date : 2014-02-17
Re: [FIXED] Can't trade on realms with '-' in the name
Thank you for reporting this (in great details !), I will add it my list of things to fix for version 1.026
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
is this still the case? made some items, can't trade them to players on my own realm (Emerald Dream).
we're set to max trust level, but saying scripts blocked.
we're set to max trust level, but saying scripts blocked.
kerryoco- Posts : 4
Join date : 2014-05-21
Re: [FIXED] Can't trade on realms with '-' in the name
I thought I've fixed it I will have to take a deeper look into that issue. It's hard to test those kind of features by myself but I will try to fix this correctly before release version 1.026.
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
I understand; 2 person issue really. Let me know if I can help, make a trade-toon
It looks like you changed the structure from what arekku referenced already, to just 'sender' ?
It looks like you changed the structure from what arekku referenced already, to just 'sender' ?
kerryoco- Posts : 4
Join date : 2014-05-21
Re: [FIXED] Can't trade on realms with '-' in the name
I've tried to use a function I've added to Total RP 2's API during the transition to connected realm that is supposed to return the name of a unit in a standardized way "PlayerName-ServeurNameWithoutWhateverSpecialCharactersInIt". This format is the format used for the sender name by the chat functions when sending messages.
When trading, several addon messages are sent using the chat functions and the sender is identified using this format. When Total RP 2 sees a trading message, it checks if the name of the sender correspond to the name of the person used when initiating the exchange. When a player is initiating a trade, the addon puts the name of his target in the exchange data. The issue is that the function to get the target name is a mess... Basically, if your target is from a realm connected to yours it will return his name+realmWithNoSpecialCharacters, but if that person is from your realm, it will return only its name. I've created a function in the API that tries to get the full name of a unit using the standard function and if the realm is not given then it takes the realm of the player, which is in the format "The realm name with everything in it" and tries to remove invalid characters. The issue here, I think, is that the character - is tricky as it is both the separator for the player name and its realm and a invalid character that should be remove from the realm's name.
I will investigate more on this issue in the next couple of days. Hopefully I can fix it for the release of version 1.026. I've seen people using an other function for getting unit names, but it seemed to have an even more obscure behavior at the time. Maybe now there is more information on addon development forum.
When trading, several addon messages are sent using the chat functions and the sender is identified using this format. When Total RP 2 sees a trading message, it checks if the name of the sender correspond to the name of the person used when initiating the exchange. When a player is initiating a trade, the addon puts the name of his target in the exchange data. The issue is that the function to get the target name is a mess... Basically, if your target is from a realm connected to yours it will return his name+realmWithNoSpecialCharacters, but if that person is from your realm, it will return only its name. I've created a function in the API that tries to get the full name of a unit using the standard function and if the realm is not given then it takes the realm of the player, which is in the format "The realm name with everything in it" and tries to remove invalid characters. The issue here, I think, is that the character - is tricky as it is both the separator for the player name and its realm and a invalid character that should be remove from the realm's name.
I will investigate more on this issue in the next couple of days. Hopefully I can fix it for the release of version 1.026. I've seen people using an other function for getting unit names, but it seemed to have an even more obscure behavior at the time. Maybe now there is more information on addon development forum.
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
May I suggest something like
NB, haven't tested this because I don't have access to a LUA console ATM
- Code:
local name, realm = string.match(s, ".+?%-.+") -- split the string
if not realm then
realm = GetRealmName()
end
realm = string.gsub(realm,"%-","")
NB, haven't tested this because I don't have access to a LUA console ATM
arekku- Posts : 14
Join date : 2014-02-17
Re: [FIXED] Can't trade on realms with '-' in the name
Thank you, I will test your code
I have to admit I never understood regular expression/matching patterns
I have to admit I never understood regular expression/matching patterns
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
Well what that expression does is
.+ match everything
?%- until we encounter a "-"
.+ then match everything
. Any character
+ 1 or more repetitions
? try to match as few characters as possible
%- match the literal character "-" (% is an escape character because - is also used to define ranges, A-Z for instance)
. Any character
+ 1 or more repetitions
You might need to put (.+?) within parenthesis to export it, not very good at lua regexps myself
Actually looking at the lua specs I see they differ from the ones I'm familiar with (POSIX)
"* Match the previous character (or class) zero or more times, as many times as possible.
+ Match the previous character (or class) one or more times, as many times as possible.
- Match the previous character (or class) zero or more times, as few times as possible.
? Make the previous character (or class) optional."
So the lua equivalent for what I usually write "+?" would be "-" (technically ..- but that won't make a difference in this particular case)
.+ match everything
?%- until we encounter a "-"
.+ then match everything
. Any character
+ 1 or more repetitions
? try to match as few characters as possible
%- match the literal character "-" (% is an escape character because - is also used to define ranges, A-Z for instance)
. Any character
+ 1 or more repetitions
You might need to put (.+?) within parenthesis to export it, not very good at lua regexps myself
Actually looking at the lua specs I see they differ from the ones I'm familiar with (POSIX)
"* Match the previous character (or class) zero or more times, as many times as possible.
+ Match the previous character (or class) one or more times, as many times as possible.
- Match the previous character (or class) zero or more times, as few times as possible.
? Make the previous character (or class) optional."
So the lua equivalent for what I usually write "+?" would be "-" (technically ..- but that won't make a difference in this particular case)
arekku- Posts : 14
Join date : 2014-02-17
Re: [FIXED] Can't trade on realms with '-' in the name
Okay, thank you for explaining this.
I understand it better now. So the issue has to come from the expression currently use that seems to get only the last part of server name containing -, so for Emerald-dream it only gets the dream part. The way I currently get the realm is really bad and there surely is a better way.
I will try your expression when I get back home.
Thank you again for the lesson ^^
I understand it better now. So the issue has to come from the expression currently use that seems to get only the last part of server name containing -, so for Emerald-dream it only gets the dream part. The way I currently get the realm is really bad and there surely is a better way.
I will try your expression when I get back home.
Thank you again for the lesson ^^
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
Managed to find an online lua interpreter (http://www.lua.org/cgi-bin/demo)
Will store qwerty in v2, and uiuiu-trrtr in v3, but return "" if there is no "-" character
[^%-]+ grabs all characters that are not minus "-"
%-? grabs 1 or 0 minus "-"
(.*) grabs whatever is left
[ start set definition
^ complimentary set to
%- the character "-" (% is escape character)
] end set
+ grab as many characters as possible, but at least 1
Unfortunately v3 ends up containing "" if there is no "-", but the result is still usable.
- Code:
var = "qwerty-uiuiu-trrtr"
v2,v3 = string.match(var,"([^%-]+)%-?(.*)")
print(v2)
print(v3)
Will store qwerty in v2, and uiuiu-trrtr in v3, but return "" if there is no "-" character
[^%-]+ grabs all characters that are not minus "-"
%-? grabs 1 or 0 minus "-"
(.*) grabs whatever is left
[ start set definition
^ complimentary set to
%- the character "-" (% is escape character)
] end set
+ grab as many characters as possible, but at least 1
Unfortunately v3 ends up containing "" if there is no "-", but the result is still usable.
Last edited by arekku on Wed May 21, 2014 11:13 am; edited 1 time in total
arekku- Posts : 14
Join date : 2014-02-17
Re: [FIXED] Can't trade on realms with '-' in the name
Thank you, it is exactly the result I need.
If v3 (realm) is empty, then I will GetCurrentRealm() and do a gsub to remove any "-" so it's like the realm in the sender name.
If v3 (realm) is empty, then I will GetCurrentRealm() and do a gsub to remove any "-" so it's like the realm in the sender name.
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
Well, I've tested again with version 1.026 beta 4 as it is right now and I get it to work. I tried to trade an item with two characters from the same realm having a - in its name (the french server Arak-arahm), and from one character from that realm with one from a realm connected to it.
Can you please confirm that it's working for you too?
Can you please confirm that it's working for you too?
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
I don't have anyone to trade with at the moment (both need to be on beta, right?)
But separate, related issue - I'm on beta now, but when I mouseover 'item preview' it still says 'scripts blocked()'
is the mechanism for preview similar to trade ?
*I should add - I'm not a very experienced beta-tester. To update to beta I just overwrote all my TRP files in Addons folder. Do I need to change SavedVariables too?
But separate, related issue - I'm on beta now, but when I mouseover 'item preview' it still says 'scripts blocked()'
is the mechanism for preview similar to trade ?
*I should add - I'm not a very experienced beta-tester. To update to beta I just overwrote all my TRP files in Addons folder. Do I need to change SavedVariables too?
kerryoco- Posts : 4
Join date : 2014-05-21
arekku- Posts : 14
Join date : 2014-02-17
Re: [FIXED] Can't trade on realms with '-' in the name
Yes, both players need to be on the latest version in order to benefit from the changeskerryoco wrote:(both need to be on beta, right?)
Thank you for reporting this. I will investigate I'm not sure about the preview. The item informations are sent when the trade is initiated, maybe that's where there is still an issue.kerryoco wrote:But separate, related issue - I'm on beta now, but when I mouseover 'item preview' it still says 'scripts blocked()'
is the mechanism for preview similar to trade ?
This is exactly the way to do it. I would advice to never touch the SavedVariables files unless told to do so. They are the files that hold every users informations for all your addons and deleting them means loosing your character's profile, your item's, your documents, everything. I actually encourage you to do a backup of this folder regularly, preferably on some cloud service, so if something bad happens (an issue with your computer, a corruption in your files) you have a previous version you can use. As those files are essentially informations, pure data, it should work from one version to another (at least looking forward, I would not recommend restoring files backed up with a version 1.n to use them in an older version 1.n-1)kerryoco wrote:To update to beta I just overwrote all my TRP files in Addons folder. Do I need to change SavedVariables too?
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
To clarify maybe- this is the preview in item creation, not in trade window. I thought maybe it's referencing my name using same mechanism. But not a big deal. Do you expect 1.026 soon?
Tx for the quick responses!
Tx for the quick responses!
kerryoco- Posts : 4
Join date : 2014-05-21
Re: [FIXED] Can't trade on realms with '-' in the name
Thank you for the clarification.
Total RP 2 version 1.026 will be released today. I will submit it to Curse this evening (central european time) after I had a look at your issue.
It usually take a few hours for Curse to approve new versions so it should be out around midnight (central european time).
Total RP 2 version 1.026 will be released today. I will submit it to Curse this evening (central european time) after I had a look at your issue.
It usually take a few hours for Curse to approve new versions so it should be out around midnight (central european time).
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
I've tried to reproduce your issue but I don't have any error.
Can you post a screenshot your issue? If you happen to have the .lua error (some addons report them) it's even better
Can you post a screenshot your issue? If you happen to have the .lua error (some addons report them) it's even better
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
here's where I'm seeing 'scripts blocked()' :
https://imgur.com/IAyXqGh
I got buggrabber but it didn't show any lua errors. This isn't affecting my gameplay at all, just thought it might be helpful.
hah, this is 'kerryoco' by the way. I changed my profile.
https://imgur.com/IAyXqGh
I got buggrabber but it didn't show any lua errors. This isn't affecting my gameplay at all, just thought it might be helpful.
hah, this is 'kerryoco' by the way. I changed my profile.
tesser- Posts : 6
Join date : 2014-05-21
Location : nyc
Re: [FIXED] Can't trade on realms with '-' in the name
Okay. Does this item have scripts on its use event? Maybe you are trying to call protected functions in a script?
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
basically the code creates a frame and listens to 'CHAT_MSG_CHANNEL' events. It works for me, so I don't think anything is protected. No one I trade it to can use it though.
pseudo-code:
bellFrame = CreateFrame("Frame")
bellFrame:RegisterEvent("CHAT_MSG_CHANNEL")
local bellFunc = function(self, event, ...)
local message, sender, language, channelString, target, flags, unknown, channelNumber, channelName, unknown, counter, guid = ...
if channelName == "WorldDefense" then
*basic lua stuff*
PlaySoundFile(*soundfile*);
end
if EvrFind ~= nil then
PlaySoundFile(*soundfile*);
end
end
end
bellFrame:SetScript("OnEvent", bellFunc);
pseudo-code:
bellFrame = CreateFrame("Frame")
bellFrame:RegisterEvent("CHAT_MSG_CHANNEL")
local bellFunc = function(self, event, ...)
local message, sender, language, channelString, target, flags, unknown, channelNumber, channelName, unknown, counter, guid = ...
if channelName == "WorldDefense" then
*basic lua stuff*
PlaySoundFile(*soundfile*);
end
if EvrFind ~= nil then
PlaySoundFile(*soundfile*);
end
end
end
bellFrame:SetScript("OnEvent", bellFunc);
Last edited by tesser on Thu May 22, 2014 2:36 pm; edited 1 time in total
tesser- Posts : 6
Join date : 2014-05-21
Location : nyc
Re: [FIXED] Can't trade on realms with '-' in the name
If it works it's just a display issue. I will ask Telkostrasz how this "script blocked" thing works. It might just be a warning and it does nothing at all.
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Re: [FIXED] Can't trade on realms with '-' in the name
still the original problem after 1.026 update:
I can use the item, but the recipient sees 'scripts blocked()' on mouseover, and can't activate it.
Trust levels set maximum.
For this item script I just had:
print("item working")
I had debug mode on for a bit - I don't know what this message means:
RECU : GTVN Ultrasoft-EmeraldDream
I can use the item, but the recipient sees 'scripts blocked()' on mouseover, and can't activate it.
Trust levels set maximum.
For this item script I just had:
print("item working")
I had debug mode on for a bit - I don't know what this message means:
RECU : GTVN Ultrasoft-EmeraldDream
tesser- Posts : 6
Join date : 2014-05-21
Location : nyc
Re: [FIXED] Can't trade on realms with '-' in the name
Okay, now I fully understand your issue and I'm sorry to tell you I can't fix it for Total RP 2. Again it is an issue with comparing names, but this time it would require a lot of changes through the entire addon to make it work.
Short story : for creations, the author's name is registered as short name "Player". For trust levels, it's in the registry, which now uses full names "Player-Realm" to store informations. When the system encounter an item with scripts, it search for the author name "Player" in the registry to check the trust level but can't find it as it's now "Player-Realm".
Changing the format for the authors' names would means previously made items won't belong to their authors anymore.
The worst way to handle this would be to remove the trust level system completely, but that would mean that any script will be execute without any security. As I already hear story about trap items that send spam as soon as they are traded, adding scripts is not a valid option for security reasons (for example, players would be able to trade items that delete the entire inventory (the real one)).
As we are building Total RP 3 from scratch, we are making it around the recent changes and hopefully it won't have those issues.
Short story : for creations, the author's name is registered as short name "Player". For trust levels, it's in the registry, which now uses full names "Player-Realm" to store informations. When the system encounter an item with scripts, it search for the author name "Player" in the registry to check the trust level but can't find it as it's now "Player-Realm".
Changing the format for the authors' names would means previously made items won't belong to their authors anymore.
The worst way to handle this would be to remove the trust level system completely, but that would mean that any script will be execute without any security. As I already hear story about trap items that send spam as soon as they are traded, adding scripts is not a valid option for security reasons (for example, players would be able to trade items that delete the entire inventory (the real one)).
As we are building Total RP 3 from scratch, we are making it around the recent changes and hopefully it won't have those issues.
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Page 1 of 2 • 1, 2
Similar topics
» [FIXED] 5.4.0 Auras bug
» [FIXED] Bug when someone speaks orc
» [FIXED] Bugged creations
» [FIXED] custom fix for the creation bug
» [FIXED] Character Icon Bug
» [FIXED] Bug when someone speaks orc
» [FIXED] Bugged creations
» [FIXED] custom fix for the creation bug
» [FIXED] Character Icon Bug
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|