[HELP!]JASS parameters.

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

owner123
Forum Staff
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 2 times

[HELP!]JASS parameters.

Post by owner123 »

I've looked all over the place, and I cant find an explanation for what the parameters do.
Like

Code: Select all

function noob takes integer i returns string s
Does someone have an explanation of what those do or how to use them?
Thanks
Last edited by owner123 on April 12th, 2010, 12:29 am, edited 1 time in total.
YellowAfterlife
Senior Member
Posts: 127
Joined: March 27th, 2010, 2:32 pm

Re: JASS parameters.

Post by YellowAfterlife »

takes input arguments. In your case you will need to call the function like:

Code: Select all

call noob(2)
(integer is a number, obviously). You can use multiple arguments for one function (might be wrong, but argument limit is around 8).
returns function output. So,

Code: Select all

set mystring = noob(2)
Obviously, you can use these variables inside of function.
owner123
Forum Staff
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 2 times

Re: JASS parameters.

Post by owner123 »

YellowAfterlife wrote:takes input arguments. In your case you will need to call the function like:

Code: Select all

call noob(2)
(integer is a number, obviously). You can use multiple arguments for one function (might be wrong, but argument limit is around 8).
returns function output. So,

Code: Select all

set mystring = noob(2)
Obviously, you can use these variables inside of function.
What does it mean to take imput arguments? and to return output? Im a JASS noob, so how would I use these, and what exactly do they do?
Last edited by owner123 on December 1st, 2010, 3:22 am, edited 1 time in total.
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: [HELP!]JASS parameters.

Post by initialD »

if you are a JASS noob, you don't learn this first. Learn GUI first.
owner123
Forum Staff
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 2 times

Re: [HELP!]JASS parameters.

Post by owner123 »

initialD wrote:if you are a JASS noob, you don't learn this first. Learn GUI first.
I know GUI, I just don't know the GUI equavilent to the parameters (if there is one)
User avatar
haxorico
Super Moderator
Posts: 3198
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: [HELP!]JASS parameters.

Post by haxorico »

As for all my knowledge about jass this is what take and return does.
Spoiler for takes:
function X takes string Y returns nothing

Well Y is 1 of 3 things.
1) a global variable that is at the globals like

Code: Select all

string Y="lolz at this string"
2) its a variable that was declared some where else. example.
Open JJ's CP at the endglboals part and find this

Code: Select all

function Cheatz takes player p2p,string s2s returns nothing
and a little beneath it you'll see

Code: Select all

function DirectCheat takes nothing returns nothing
local player p2p=GetTriggerPlayer()
local string s2s=GetEventPlayerChatString()
in that function you'll see

Code: Select all

call Cheatz(p2p,s2s)
So the local variables p2p and s2s are used on the function Cheatz. So the function Cheatz. takes those 2 variables.

3) A variable that was returned on a different function.

There could be other explanation though I'm not much of a pro jasser
Spoiler for return:
Some rules

If the function returns nothing it CANNOT have a return any where as it doesn't return anything..
If it returns something it has to have a return some where. This rule helped me when enabling SP so just so you know. If you delete a return in the function itself. go the the function name itself.

As for the explanation

Well once again going to JJ's CP endglobals part.
look for this function

Code: Select all

function Cheatz0r takes nothing returns boolean
return(IsPlayerInForce(GetTriggerPlayer(),CHEATER))
endfunction
as you can see it returns a boolean. in other words, it returns true or false. true or false about what? well is the triggering player in the Force (Player group in other words) called CHEATER

now go look at the function main part for this

Code: Select all

call TriggerAddCondition(CHEATS,Condition(function Cheatz0r))
The condition for the function CHEATS to work. Is if the function Cheatz0r is true.

So if it returned true the function will work. If not. It won't.
That's the way I understand it. If any pro jasser wants to fix me then please be my guest :)
Hope I helped you understand what return and take means
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac: 

Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).

Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: [HELP!]JASS parameters.

Post by initialD »

so it's just very simple I understand them now. Thanks.
It's like, for an example, I take something from my friend, it'd be better if I return something else back to him. If not they won't be my friend anymore. I get it.