• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Problems when code is finished

Status
Not open for further replies.
Level 8
Joined
Sep 25, 2007
Messages
382
hi people , im having problems when the code is finished , as it is showed on the title...

when i finish the coding , it sends me as much errors as code lines i coded , so , i cant even code the text "Call BJDebugMsg(Hello , My Name is lol)"...

someone help ?
 
Level 8
Joined
Sep 25, 2007
Messages
382
for example , i used just a simple trigger with:

JASS:
function HelloWorld takes nothing returns nothing
    call BJDebugMsg("Hello lol")
endfunction

i just used that , and i was having problems , also , i want to know how can i make the message appear lol , it does not appear at all
 
Level 8
Joined
Sep 25, 2007
Messages
382
so i should make a trigger with a condition with elapsed game time , or am i wrong ? , also , do you have any good tutorial about making some spells on JASS , i just saw Knockback and AoE things... but dunno if they work well...
 
Level 8
Joined
Sep 25, 2007
Messages
382
i already read tutorials , but they are all the same basics or advanced tips , so , i was just asking if there was any "how to make (ability) in JASS" tutorials... lol , though there aren't any... it would be good too... btw i tried doing what you say (converting GUI to JASS) , and well , it works , the effect was not great but , it was rly useful...
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,538
i already read tutorials , but they are all the same basics or advanced tips , so , i was just asking if there was any "how to make (ability) in JASS" tutorials... lol , though there aren't any... it would be good too... btw i tried doing what you say (converting GUI to JASS) , and well , it works , the effect was not great but , it was rly useful...

Thats the advantage of coding in jass.
 
Level 8
Joined
Sep 25, 2007
Messages
382
Thats the advantage of coding in jass.

whjat i was saying is , that it was not a rly good progress with converting GUI to JASS , but it was useful , just that...lol...

btw i readed a tutorial of knockback in JASS and it was rly hard , but , well , i can learn :pal:
 
Level 8
Joined
Sep 25, 2007
Messages
382
i already know JASS lol , how many time i have to repeat it , i dun want to know more , if not to applicate what i know... so i get more used to JASS... but its hard to find any "diferent" tutorial of JASS...
 
Level 8
Joined
Sep 25, 2007
Messages
382
You obviously do NOT know Jass well enough to even think about making spells if you can't even get that simple BJDebugMsg to show up...

i already read how to , i have to call it , i forgot of it... lol...

btw , i dunno enough to do lots of skills , thats i want to know if there are some spells examples , so i can learn how to do some of thems...

Still i having some problems with the return value , dun understand it too much , but i think i know the purpose of it (just supposing).
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
A function in mathematics returns a value. For example:

Y = f(X)
Y = x² + 2x - 5

In this case, our function is x² +2x - 5.

Translated into programming, this would become:

function f takes real x returns y

the returnvalue is the "result" of the function. e.g. in mathematics, we take x = 2, thus y = 2² +2*2 - 5 = 3.
3 is the returned value.

JASS:
function f takes real x returns real
    local real y
    set y = x*x + 2*x - 5
    return y
endfunction

function LOOOOL takes nothing returns nothing
    local real y
    set y = f(5)
    call BJDebugMsg("f(5) = " + I2S(y))
endfunction

Other functions such as "UnitAddAbility" return a boolean, i.e. true if the ability was succesfully added. An example where UnitAddAbility would return false is when you're adding an ability that was already added.

Hope you understand more of return values now.
 
Level 8
Joined
Sep 25, 2007
Messages
382
ahhh ok , im starting to understand the return value...

PD: Sended a PM to Element of Water.

PD2: i may finish of asking things in this post , im going out of the plot lol , so , the finish thing , how do i call the function

call (Function Name)?...
 
Level 8
Joined
Sep 25, 2007
Messages
382
so if it is:

JASS:
function HelloWorld takes nothing returns nothing
    local string Msg = BJDebugMsg("Hello")
endfunction

function Asd takes string returns nothing
    call function("HelloWorld")
enfunction

that way ? sry if i dunno understand , my english isnt too good...
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,538
no. here lemme help out.

JASS:
function returnsText takes nothing returns string
    return "HELLO WORLD!!!!!"
endfunction

function Trig_timeCreateText_Actions takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,returnsText())
endfunction

function InitTrig_timeCreateText takes nothing returns nothing
    set gg_trg_timeCreateText = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_timeCreateText,1,false)
    call TriggerAddAction(gg_trg_timeCreateText,function Trig_timeCreateText_Actions)
endfunction
 
Level 8
Joined
Sep 25, 2007
Messages
382
no. here lemme help out.

JASS:
function returnsText takes nothing returns string
    return "HELLO WORLD!!!!!"
endfunction

function Trig_timeCreateText_Actions takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,returnsText())
endfunction

function InitTrig_timeCreateText takes nothing returns nothing
    set gg_trg_timeCreateText = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_timeCreateText,1,false)
    call TriggerAddAction(gg_trg_timeCreateText,function Trig_timeCreateText_Actions)
endfunction

ah , ok thx for explaining... it helps me a lot...
 
Status
Not open for further replies.
Top