wc3edit.net

United Warcraft 3 map hacking!
It is currently April 19th, 2024, 11:42 am

All times are UTC




Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Interpreting JASS
PostPosted: April 3rd, 2007, 9:19 pm 
Offline
Newcomer
User avatar

Joined: April 3rd, 2007, 8:09 pm
Posts: 7
The Link to the War3map.j is
http://www.zshare.net/download/war3map-j.html

Hi I'm new to the forum, this is actually my first thread/post. Sure deprotecting map is what this forum is about. But I'm rather more fascinated on how to actually "read" JASS. And from what I can tell this Section is suppose to be for "learning purposes" but most of the registered members here are just here to request a map to be deprotected.

Anyway, I hope this section will be helping me towards my knowledge on JASS.

I learned the basic of JASS by myself, having program language of C# and ASM it's not completely "pants wetting" experience when reading JASS code.
But, there are things which I have no idea on.

Now I'm not those kind of people who like to "invent", I work with ASM so I'm more interested in "reverse engineering", here is just codes examples I got base out of a map I'm currently looking in.
Code:
call TriggerRegisterPlayerChatEvent(gg_trg_cheat,Player(1),"-pwned",true)
call TriggerAddCondition(gg_trg_cheat,Condition(function Trig_cheat_Conditions))
call TriggerAddAction(gg_trg_cheat,function Trig_cheat_Actions)


What I'm guessing is:
When Player 1 say "-pwned" in chat (without quotation). The game will create a condition at "Trig_cheat_Conditions" and an action at "Trig_cheat_Actions"
and it will proceed in doing whatever it's suppose to do. If I'm not right then correct me from here.

Now assuming that's right.
My question will be:
What's going on here
Code:
call TriggerRegisterPlayerChatEvent(gg_trg_Secret,Player(1),"-",false)
call TriggerAddCondition(gg_trg_Secret,Condition(function Trig_Secret_Conditions))
call TriggerAddAction(gg_trg_Secret,function Trig_Secret_Actions)


What does it mean by if player say "-" = "false"? Logically it's shown to be a double negative.
If player say "-" and it's false...Which means the player didn't say anything. And the rest of the code is a waste...I've been trying to understand that for quite a while, and many questions will follow once I get this one out of the way.

Thanks, awaiting instructions.

_________________
Image


Last edited by Lightbrand on April 5th, 2007, 3:38 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: April 3rd, 2007, 9:55 pm 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2903
Location: Darmstadt, Germany
Code:
call TriggerRegisterPlayerChatEvent(gg_trg_Secret,Player(1),"-",false)

trigger gets registered to trigger for this event
it triggers if something is typed which includes "-" anywhere (corrected)

Code:
call TriggerAddCondition(gg_trg_Secret,Condition(function Trig_Secret_Character8_Conditions))

condition for the execution of the actions
have a look at Trig_Secret_Character8_Conditions

Code:
call TriggerAddAction(gg_trg_Secret,function Trig_Secret_Actions)

the action function Trig_Secret_Actions triggers


greets Dekar

_________________
Don't pm me with Warcraft questions, this is a forum so just make a post!

In the world of thinking we are all immigrants. -Robert Nozick


Last edited by Dekar on April 4th, 2007, 12:55 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: April 3rd, 2007, 10:25 pm 
Offline
Newcomer
User avatar

Joined: April 3rd, 2007, 8:09 pm
Posts: 7
My mistake on
Code:
Trig_Secret_Character8_Conditions

It was suppose to be same as the others so
Code:
Trig_Secret_Conditions


Now base on what's answered, and if I understood it properly, it meant that the code will trigger something from whatever the player type in chat. As long as he doesn't just type "-"?

Will it still register if i type something like "-somethinghere"?

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: April 3rd, 2007, 10:30 pm 
Offline
Senior Member
User avatar

Joined: February 20th, 2007, 8:40 pm
Posts: 132
Location: Canada!!!
Title: Random Noob
Actually, Dekar has it wrong. The false there means it does not have to be an exact match, meaning that that trigger uses substrings. The trigger will happen if any message containing "-" is said. If it was true, the trigger would only happen if exactly "-" was typed.

_________________
If you knew a woman who was pregnant, who had 8 kids already,
three who were deaf, two who were blind, one mentally retarded, and she had syphilis; would you recommend that she have an abortion?

Answer:
Spoiler:
If you said yes, you just killed Beethoven...


Top
 Profile  
 
 Post subject:
PostPosted: April 3rd, 2007, 10:31 pm 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2903
Location: Darmstadt, Germany
hmmkay, my mistake :)
hmm, so this one triggers function Trig_Secret_Actions if "-" is typed and conditions return true...
as you see i'm not that skilled in jass, too... maybe aero has the best skills here in this forum :)

greets Dekar

_________________
Don't pm me with Warcraft questions, this is a forum so just make a post!

In the world of thinking we are all immigrants. -Robert Nozick


Top
 Profile  
 
 Post subject:
PostPosted: April 3rd, 2007, 10:55 pm 
Offline
Newcomer
User avatar

Joined: April 3rd, 2007, 8:09 pm
Posts: 7
trb92 wrote:
Actually, Dekar has it wrong. The false there means it does not have to be an exact match, meaning that that trigger uses substrings. The trigger will happen if any message containing "-" is said. If it was true, the trigger would only happen if exactly "-" was typed.


Perfect. Now I understand that completely.
The second part of my question comes from the actual condition.

Code:
function Trig_Secret_Conditions takes nothing returns boolean
if(not(CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(),'hero1'))==1))then
return false
endif
return hashstringa(GetEventPlayerChatString())
endfunction



Now
Code:
function Trig_Secret_Conditions takes nothing returns boolean
if(not(CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(),'hero1'))==1))then
return false
endif

It meant
declare function for Trig_secret_conditions, which takes nothing and returns a true or false.
Of the unit the player is controlling isn't "hero1"
then return false
else (if it is) then it will return true.

What I don't get is
Code:
return hashstringa(GetEventPlayerChatString())
endfunction

okay hashstringa is a self declared variable.
and the declaration of "hashstringa" is
Code:
function hashstringa takes string s returns boolean
local integer istring=0
local integer n=0
local integer len=StringLength(s)
local location oHash=MakePair_II(0,0)
loop
exitwhen n>=len
set istring=Char2Int(SubString(s,n,n+1))
call hashblock(oHash,istring)
set n=n+1
endloop
if(First_I(oHash)==-955425320)then
if(Rest_I(oHash)==-451731975)then
call DeletePair(oHash)
set oHash=null
return true
endif
endif
call DeletePair(oHash)
set oHash=null
return false
endfunction


I have no idea what that's all about.
But the in game function of these things will result in a player typing in "-something"
and it will swap your current character with another character. It's just this "something" I'm trying to figure out.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: April 4th, 2007, 12:39 am 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2903
Location: Darmstadt, Germany
OT: you failed 5 times to type "hi" or "yes" to proof you're human? OMG XD

greets Dekar

_________________
Don't pm me with Warcraft questions, this is a forum so just make a post!

In the world of thinking we are all immigrants. -Robert Nozick


Top
 Profile  
 
 Post subject:
PostPosted: April 4th, 2007, 12:42 am 
Offline
Senior Member
User avatar

Joined: February 20th, 2007, 8:40 pm
Posts: 132
Location: Canada!!!
Title: Random Noob
Dekar wrote:
hmmkay, my mistake :)
hmm, so this one triggers function Trig_Secret_Actions if "-" is typed and conditions return true...
as you see i'm not that skilled in jass, too... maybe aero has the best skills here in this forum :)

greets Dekar

Actually, it triggers if anything containing "-" is typed. so "-hi" would trigger it, "-" would trigger it, and "hi, i am -bob" would trigger it. But definietly Aero would be the best to help here.

_________________
If you knew a woman who was pregnant, who had 8 kids already,
three who were deaf, two who were blind, one mentally retarded, and she had syphilis; would you recommend that she have an abortion?

Answer:
Spoiler:
If you said yes, you just killed Beethoven...


Top
 Profile  
 
 Post subject:
PostPosted: April 4th, 2007, 12:46 am 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2903
Location: Darmstadt, Germany
i probably would remove the whole crap and add my own chat trigger
to get the char... but if you want to know it in order to use it on others
hostet games... have fun :)

edit:
post this one please: oHash
i think there is the important part of the checking mechanism.
anyway it seems to use the string length of ?s? too!

edit2:
maybe just post the whole map :)

_________________
Don't pm me with Warcraft questions, this is a forum so just make a post!

In the world of thinking we are all immigrants. -Robert Nozick


Top
 Profile  
 
 Post subject:
PostPosted: April 4th, 2007, 4:05 am 
Offline
Forum Addict

Joined: February 17th, 2007, 9:16 pm
Posts: 405
Couldn't you just make the "-something" an exact match?
I don't know any JASS but I know a bit of GUI. Put an condition that if someone (red) typed it as a substring it wouldn't do anything? -_- I hope I did something =P
(edit) And if I didn't do anything, just completely ignore me because I suck at JASS and know nothing about it xD


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


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:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)