(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Tutorials > JASS/AI Scripts Tutorials

JASS/AI Scripts Tutorials Contains tutorials regarding JASS scripting and the AI editor.
Read the Rules before posting.

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 10-31-2005, 11:18 AM   #16 (permalink)

User
 
Join Date: Mar 2005
Posts: 169

BertTheJasser is an unknown quantity at this point (0)


Q1: Yes, you can. BUT only if you want to use it IMMEDIATLY, if not, the global can be overwritten by another of your triggers(maybe you use the var multiple times).

Q2: To prvent things like that, you must make your globals arrays and you need a counter for the array index. That was what you missunderstood.

Clear?
__________________
BertTheJasser is offline  
Old 12-12-2005, 07:09 PM   #17 (permalink)
 
Thunder_eye's Avatar

User
 
Join Date: May 2004
Posts: 207

Thunder_eye has little to show at this moment (5)


Whats wrong with this, its just a test trigger for using locals

the errors I get only contains the ones with the
local a, what to I do wrong?

Is the only problem that the local is after the first function?
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
    set a = ( a + "1" )
    call DisplayTextToForce( GetPlayersAll(), a )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
    local string a
    call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_003, 1.00 )
    call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
Thunder_eye is offline  
Old 12-14-2005, 05:15 AM   #18 (permalink)
 
Daelin's Avatar

Kelani mage
 
Join Date: Jul 2004
Posts: 3,305

Daelin is just really nice (336)Daelin is just really nice (336)Daelin is just really nice (336)

Respected User: This user has been given the respected user award. Special Effect Competition #1 Winner: Frozen Effects 

Well, your problem is more than obvious. Locals are visible (can be used) only in the function in which you declare them, not trigger. Conclusion? Your code should look like this:

function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
local string a
set a = ( a + "1" )
call DisplayTextToForce( GetPlayersAll(), a )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_003, 1.00 )
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction

Oh, and be careful, you must declare locals in a function BEFORE doing anything else. For example, in your section function you did this:

set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
local string a

INCORRECT! Setting a value to a variable is also an action. This is correct:

local string a
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )

Hope this helped!

~Daelin
__________________
“The more you judge, the less you love”



Daelin is offline  
Old 12-14-2005, 08:20 PM   #19 (permalink)

User
 
Join Date: Sep 2004
Posts: 249

vicky2004 is an unknown quantity at this point (0)


When u have local vars that you won't set again and u'll only use as data locals,you can set them right when u make them.So:
local string a
set a = ( a + "1" )
turns to:
local string a=a+"1" //Or a=a+I2S(1)
Not nessecery but it's good to arrange your script.
vicky2004 is offline  
Old 01-08-2006, 08:21 PM   #20 (permalink)

User
 
Join Date: Nov 2005
Posts: 7

Morrow's Grief is an unknown quantity at this point (0)


How do you determine "take" and "return" values for a function?
__________________
255 Characters isn't enough for ASCII? EVIL!
Morrow's Grief is offline  
Old 01-09-2006, 05:04 AM   #21 (permalink)
 
Daelin's Avatar

Kelani mage
 
Join Date: Jul 2004
Posts: 3,305

Daelin is just really nice (336)Daelin is just really nice (336)Daelin is just really nice (336)

Respected User: This user has been given the respected user award. Special Effect Competition #1 Winner: Frozen Effects 

For Blizzard functions? Use Jass Shop Pro!

~Daelin
__________________
“The more you judge, the less you love”



Daelin is offline  
Old 04-25-2006, 03:15 AM   #22 (permalink)

User
 
Join Date: Apr 2006
Posts: 17

TroubleShooter is an unknown quantity at this point (0)


well i dont know sh*t about jass i just dont get it :S

why is there

blablabla TAKES nothing blablabla RETURNS nothing

and why sometimes TAKES something and RETURNS something

and sometimes Takes nothing RETURNS something :S:S:S

and what can u do with JASS taht u cant with GUI? only local variables? actualy its 4 15 o clock ill read it agian when im less sleepy.
__________________
•••|-Troubleshooter-|•••
TroubleShooter is offline  
Old 08-20-2006, 11:14 AM   #23 (permalink)

User
 
Join Date: Aug 2006
Posts: 3

Dota-Demon[aS] is an unknown quantity at this point (0)


i got a language problem if anyone could help me i will be very happy lol. my problem is that i got spanish version and i dont know wich hability is locust if u could tell me in spanish or tell me one unit allreay has it to me to look for it it will be cool, ty m8s
__________________
__0000_0000___
_00000000000__
I __000000000__ CHIKEN
__000000__
___000__
LOVE
Dota-Demon[aS] is offline  
Old 11-04-2006, 12:17 AM   #24 (permalink)
 
Marcelo Hossomi's Avatar

Brazil Fan
 
Join Date: Dec 2005
Posts: 415

Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)


Can I post a topic translating this tutorial to Portuguese?
__________________

YIN-YANG BATTLE - remaking
too disorganized!

WIZARDS ARENA - active
TERRAINiii - HEROESiiii - EVENTSiiii

Marcelo Hossomi is offline  
Old 11-04-2006, 07:55 AM   #25 (permalink)
 
Daelin's Avatar

Kelani mage
 
Join Date: Jul 2004
Posts: 3,305

Daelin is just really nice (336)Daelin is just really nice (336)Daelin is just really nice (336)

Respected User: This user has been given the respected user award. Special Effect Competition #1 Winner: Frozen Effects 

Dota-Demon[aS]... The rawcode is 'Aloc' and I think rawcodes are the same for all the languages. You can shift+double click on the abilities field and manually add Aloc yourself. :)

Marcelo Hossomi... Go ahead. Though this tutorial is quite rusty and could use some improvements... Though I don't have time for that right now.

TroubleShooter... Infact, there are a lot of things that make JASS better than GUI. Here are some of the reasons (by Vexorian):

Quote:
Originally Posted by Vexorian
JASS Advantages
If you use JASS directly instead of GUI you win:
Functions: you can make your own functions and that will save you time
Efficiency: Typing is faster than clicking with the mouse
Ability to write more optimized code: GUI's automatization is not flexible enough to make well optimized code and it most of the times will generate really slow code.
Local variables and multi instancibility : GUI is simply not good to make things multi player proof.
Access to 'hidden' native functions : For some reasons GUI does not allow you to use a lot of functions like those related to memory leaks (you won't be able to fix a big quantity of memory leaks in GUI)
~Daelin
__________________
“The more you judge, the less you love”



Daelin is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning JASS Tutorial Series wyrmlord JASS/AI Scripts Tutorials 120 12-31-2008 12:12 PM
JASS Scripting - AI Tutorial Modo Requests 0 10-17-2007 07:22 AM
[JASS] Tutorial JASS - PORTUGUÊS Marcelo Hossomi Triggers & Scripts 0 12-01-2006 01:30 AM
passing local variable in JASS? Channeled effects with JASS? kuraruka Triggers & Scripts 2 02-10-2006 11:38 PM
[JASS] Can Somone Point me to a JASS tutorial? Yu_Yevon Triggers & Scripts 0 02-06-2005 10:31 PM

All times are GMT. The time now is 05:23 PM.






Your link here 
Car Loan | Bankruptcy | Mobile Phones | MPAA | Credit Cards
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle