HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Everything you always wanted to know about custom text but were afraid to ask

09-14-2002, 04:55 AM#16
Guest
1) JASS, where does this term come from?

2) Are there any reserved words that could easily be used by accident?

3) Can functions be overloaded(same name, different inputs)?

4) Can I use one functions output as the input of another function?

5) Could I use a function to generate a custom dialog box?

6) The built-in function and variable naming has prefixes, anybody have a clue what they are/mean? Do I need to include these in my custom naming?

Thanks for the support guys! :) I will problably start some documentation as I become more familar with the language.
09-14-2002, 02:29 PM#17
weaaddar
1) Its the name given by blizzard to the scripting language (as seen in Blizz.j and common.j)
2) Not exactly sure of all of them but if you use global varaibles you won't run into this problem as global vars add the prefix udg_
3) Certainly
4) Yes
5) Check out superikis engine for a good example or read the thread about dialog menus
6) Udg_=User defined global. Trig=Trigger Func=function. BJ=Something found in blizzard.j (aka fluff function).
09-14-2002, 05:44 PM#18
Guest
1. Where are common.j and blizz[ard].j ? I can't seem to find these files. Are they files which are archived into map files that I'd need a seperate tool to extract? If so, does anyone have a copy of them online I could download for reference?

2. Can I get the colour of a Unit, and use this to look up the corresponding Player's Index? I'm changing ownership of Units to a computer player (while preserving the Units' colour) and I want a way to give the Units back to their original owners. If I could turn the Unit's colour into a Player Index, I could do it.

P.S. This forum is great!
09-14-2002, 06:06 PM#19
Ari
You can find both of those files in War3patch.mpq (they're also in the regular mpq, but for some reason, I can't extract them from there.) You'll need an mpq viewer to take a look at these (there's plenty of threads you can search for help on using one of thse)
09-14-2002, 06:34 PM#20
weaaddar
you can check the color by number knowing that 0-11 are red through brown and 12-15 are blackish grey. You can't get color unfortuantly but can check owner thats as best as you can do.
09-14-2002, 06:56 PM#21
SuperIKI
You want to give the units back to it's previous owner?
Then you can make a unit group array and store the units that belonged to player 1 in slot 1 and so on.
When acting with a unit group array, make sure you call CreateGroup before using the array slot.
09-15-2002, 08:49 PM#22
dataangel
Stickied.
09-16-2002, 04:21 AM#23
DKSlayer
Two questions, First one, can I declare a Global Variable in Custom Text.

Second If I create a function within a trigger it's ok. I can say what it takes, and as long as I keep it to returning nothing I have no problem. But as soon as I tell it to return anything else it freaks and pops up dialog and bye bye map. Is htat just a WE bug, or is their something I am doing wrong. Thanks
09-16-2002, 03:06 PM#24
SuperIKI
1. No. Only by editing the .j file. Just use the normal variable editor to create globals.
2. WE bug as following:
If you state a function to return something it must return something! If you leave out the 'return' statement in your function, WE will crash.
09-16-2002, 03:53 PM#25
DKSlayer
Yea, I found out about the functions last night I was miss typing a couple of things. But couldn't get net on last night to edit my post. Thanks though.

Bummer that bugs the crap out of me I can't declare global variables. I don't want to use the gui interface. I got one trigger that will be Cross-Map Compatiable. So I don't want users to have to deal with varaibles. I want it done right the first time.

Thanks Guys

octothorpe
I have found out how to check find out who a player is (player ID) using The Players Color. Come talk to me either in the Chat room, on most of the time or PM me and let me get your MSN, AI, Yahoo, or I will just PM you back with the code I think might help you.
09-16-2002, 09:49 PM#26
Guest
Thanks for looking into that for me. Can you just post it here? I'm a Perl programmer, so I can likely figure it out given the code, I just don't know where to start. Maybe as an attachment if you're worried about using up too much space.

Thanks! :)
09-17-2002, 04:08 AM#27
DKSlayer
Here is a modded down version of mine since I think what I was doing is not quite what you had in mind. All You need to do is call this function, ColorConverter(PLAYER_COLOR_RED) It will return the player ID of the Red Player. You just need to get the color of whatever plyaer you want in there. Holler if you are looking for something different. Please give me credit if this has helped, Thanks. :)

//=============================================
// The ColorConverter (It Converts the Color into the Player ID)
// By DKSlayer
//=============================================
function ColorConverter takes playercolor CompColor returns player
//============================================
// Integers required for the ColorConverter
//============================================
local playercolor CompColor = PLAYER_COLOR_RED
local integer j = 0
local player CompPlayer

loop
if (GetPlayerColor(Player(j)) == CompColor) then
set CompPlayer = Player(j)

endif
set j = j + 1
exitwhen(GetPlayerColor(Player(j)) == CompColor)
endloop
return CompPlayer
endfunction
09-17-2002, 06:01 PM#28
Guest
If you look at my original post, I'm interested in getting the colour of a unit, not a player. Unfortunately, this code doesn't help.
09-17-2002, 07:12 PM#29
weaaddar
Well I have a huge resource of custom text probably the only project that is completely done in custom text that you can download look at question and wonder how in the fugg did i do becuase the commentry on it is TERRIBLE. http://wc3campaigns.com/forums/showt...&threadid=3845
09-17-2002, 08:12 PM#30
SuperIKI
My dialog engine is completely written in custom text, too. And the thread contains a lot of information about how it works:
http://www.wc3campaigns.com/forums/s...&threadid=2720

And I agree with weaaddar: The code for the bag item is HORRIBLE to read! OMG! If you believe you just made a crappy looking piece of code and you think it couldn't come worse... :D
Don't be mad on me now, weaaddar. Just kidding.

But remember: It's good if it works. That's all. You won't get a beauty price for JASS coding.