Page 1 of 3

Werid? o.o

Posted: October 14th, 2011, 9:47 pm
by naturesfury
Ok -.- I noticed two things.....anyone wanna verify for me?

1) case sensativity.... even if you do call TriggerRegisterPlayerChatEvent(trigger,Player(0),"-werid",true) -Weird works as does all variations -WEiRD -WeirD -wEiRd etc but if you add spaces (even one) after it, it doesnt trigger it....

2) in lan,
if GetPlayerName(Player(zzz))=="myname"then
call do something
endif
doesnt do that something =/
had to type in the activator to test... (this is JJCP if it matters....which i doubt cuz i tried with my CP too)
I think it has something to do with the GetPlayerName but when i did
call DisplayTextToPlayer(display string GetPlayerName(GetTriggeringPlayer())
it showed me my name

*note: syntax may be wrong....didnt rly bother to check/do it right

Re: Werid? o.o

Posted: October 15th, 2011, 12:17 am
by UndeadxAssassin
Seriously....werid?...

On another note, that's because triggerregisterplayerchatevent isn't case sensitive (as opposed to something like substring) , but when you type true at the end, it has to be an exact match, whereas with false, it just has to be partial.

As for the second part, did you set/loop zzz?
I don't know how names for LAN works, either, but that might be a problem, too.

Re: Werid? o.o

Posted: October 15th, 2011, 12:27 am
by owner123
naturesfury wrote:Ok -.- I noticed two things.....anyone wanna verify for me?

1) case sensativity.... even if you do call TriggerRegisterPlayerChatEvent(trigger,Player(0),"-werid",true) -Weird works as does all variations -WEiRD -WeirD -wEiRd etc but if you add spaces (even one) after it, it doesnt trigger it....

2) in lan,
if GetPlayerName(Player(zzz))=="myname"then
call do something
endif
doesnt do that something =/
had to type in the activator to test... (this is JJCP if it matters....which i doubt cuz i tried with my CP too)
I think it has something to do with the GetPlayerName but when i did
call DisplayTextToPlayer(display string GetPlayerName(GetTriggeringPlayer())
it showed me my name

*note: syntax may be wrong....didnt rly bother to check/do it right

Could have sworn TriggerRegisterPlayerChatEvent was case sensitive. Know how on cheatpacks -CHEATS<><> won't work but -Cheats<><> does?
And ofcourse it doesn't work if you add a space.. it's completely different text then. It's like saying "if I type -weird it works but it does not work if I add a A to the end of the message."
JASS/GUI text events have always been a gray topic for me. IIRC it is not case sensitive if done in GUI, but is if done in JASS.

Ya, it's not gonna do anything in LAN because you can choose your name in lan. That's my explanation at least. Although I don't know how savecodes work on LAn if that's true as I'm pretty sure it checks your code with your name to see if it really is yours.

Re: Werid? o.o

Posted: October 15th, 2011, 12:37 am
by UndeadxAssassin
For the record, JJ's cheatpack uses substring for the activator.

Code: Select all

if SubString(GetEventPlayerChatString(),0,100)==Activator and not IsPlayerInForce(p2p,CHEATER) then


Fai's too.

Re: Werid? o.o

Posted: October 15th, 2011, 12:39 am
by owner123
Nevermind then =\

Re: Werid? o.o

Posted: October 15th, 2011, 12:40 am
by naturesfury
hmmm your first explanation might be right o.o

for the second, it used to work before =/

Re: Werid? o.o

Posted: October 15th, 2011, 1:26 am
by haxorico
TriggerRegisterPlayerChatEvent is NOT case sensitive, and as said by UndeadXAssasin, the TRUE at the end meaning its an exact match. If you look at JJ's CP it says False at the end, and the string is "-". So each time you write a word that contains the character "-" it checks for your cheats.

On another note. GUI is not case-sensitive because it uses TriggerRegisterPlayerChatEvent for EVERY single command. Thats why it takes 20 triggers for 20 commands, while if you know jass you can do it in 1 trigger (like JJ's CP does).

Now for substring. Lets look at the following code.

Code: Select all

function X takes nothing returns nothing
local string chat="-Gold"
local string command="-gold"
if chat==commands then
//give gold
endif
endfunction

Lets say that you entered the word "-Gold" (the variable called "chat") it won't match the command as it is "-gold" even if logicaly G=g, its a computer, and it sees the following:

Code: Select all

if "-Gold"=="-gold" then

You can see they are NOT a match. So how do we fix the problem? Well JASS has a built in command if you want it NOT case-sensitive.

Code: Select all

function X takes nothing returns nothing
local string chat=StringCase("-Gold",false)
local string command="-gold"
if chat==commands then
//give gold
endif
endfunction

What StringCase does, it takes a string (first paramter) and turns all its characters to either upper (true) or lower (false) case characters (second parameter). So now "-Gold" is set to "-gold".

Hope that clears things out.

Re: Werid? o.o

Posted: October 15th, 2011, 3:28 am
by naturesfury
lol....ik you're trying to help out....but I don't think you said anything the others didnt xD except stringcase but you already told me that

know anything about lan names?

Re: Werid? o.o

Posted: October 15th, 2011, 9:08 am
by haxorico
LAN Names? Care to give an example?

Re: Werid? o.o

Posted: October 15th, 2011, 2:13 pm
by UndeadxAssassin
He's talking about when you try to use name activator in LAN. It won't work, apparently. Although, it's strange because it should work if he has the case and everything correct.