HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

NEW! JASS function pack, please contribute

09-23-2003, 03:49 AM#181
dataangel
Quote:
Originally posted by KaTTaNa
I think you should add this function. It's very simple, but useful when creating fake "Pick units in group" actions.


Uh, what's the difference between that and just specifying the original group?
09-23-2003, 02:01 PM#182
PitzerMike
Me always forgets if the source group or the target group is the first parameter.
That's why I think it would be quite handy.
09-24-2003, 07:41 PM#183
KaTTaNa
Doesn't it ever bother you that you can't access local variables when using the ForGroup() function?
You probably already know of this method:
Code:
loop
   exitwhen IsUnitGroupEmptyBJ( victims )
   set current = GroupPickRandomUnit( victims )
                
   // Actions
   call GroupRemoveUnit( victims, current )
endloop
But after this loop has run, victims is empty, and you might need it later. So you can use assign another local variable to CloneGroup( victims ) and use that, so victims remains untouched.
09-24-2003, 08:00 PM#184
AIAndy
Quote:
Originally posted by KaTTaNa [b]
Code:
loop
   exitwhen IsUnitGroupEmptyBJ( victims )
   set current = GroupPickRandomUnit( victims )
                
   // Actions
   call GroupRemoveUnit( victims, current )
endloop

Never use GroupPickRandomUnit with such a loop. It is very inefficient. Instead use FirstOfGroup. The loop is then as follows:
Code:
loop
   set current = FirstOfGroup( victims )
   exitwhen current == null

   // Actions
   call GroupRemoveUnit( victims, current )
endloop
09-24-2003, 08:33 PM#185
KaTTaNa
Quote:
Originally posted by AIAndy
Never use GroupPickRandomUnit with such a loop. It is very inefficient. Instead use FirstOfGroup.
You right :knife: but the point was that it eliminates the group one way or another.
09-29-2003, 11:59 PM#186
Vexorian
Code:
//Simulates an interface error message for a specified player
function SimError takes player ForPlayer, string msg returns nothing
    local sound error = CreateSound( "Sound\\Interface\\Error.wav", false, false, false, 10, 10, "HeroAcksEAX" )
    if (GetLocalPlayer() == ForPlayer) then
       call ClearTextMessages()
       call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
       call SetSoundParamsFromLabel( error, "InterfaceError" )
       call SetSoundDuration( error, 614 )
       call SetSoundChannel( error, 6 )
       call PlaySoundBJ( error )
    endif
endfunction
10-02-2003, 01:31 PM#187
Vexorian
Code:
//Converts a Player's team color into a string of 9 characters, mainly for use of the next 3 functions, Althought you can use this one directly.
//============
function TeamColor2RGB takes playercolor col returns string
      if col == PLAYER_COLOR_RED then
            return("255000000")
      elseif col == PLAYER_COLOR_BLUE then
            return("000000255")
      elseif col == PLAYER_COLOR_CYAN then
            return("000255192")
      elseif col == PLAYER_COLOR_PURPLE then
            return("128000128")
      elseif col == PLAYER_COLOR_YELLOW then
            return("255255000")
      elseif col == PLAYER_COLOR_ORANGE then
            return("255128000")
      elseif col == PLAYER_COLOR_GREEN then
            return("000255000")
      elseif col == PLAYER_COLOR_PINK then
            return("255000255")
      elseif col == PLAYER_COLOR_LIGHT_GRAY then
            return("192192192")
      elseif col == PLAYER_COLOR_LIGHT_BLUE then
            return("128192255")
      elseif col == PLAYER_COLOR_AQUA then
            return("000064064")
      elseif col == PLAYER_COLOR_BROWN then
            return("064064000")
      else
            return("000000000")
      endif
endfunction


Code:
// These three functions convert a player's Team color into an integer correspondent to the Red, green or blue value of the RGB color - Require TeamColor2RGB()
//===============

function TeamColorRed takes playercolor col returns integer
      return(S2I(SubString(TeamColor2RGB(col),0,3)))
endfunction

function TeamColorGreen takes playercolor col returns integer
      return(S2I(SubString(TeamColor2RGB(col),3,6)))
endfunction

function TeamColorBlue takes playercolor col returns integer
      return(S2I(SubString(TeamColor2RGB(col),6,9)))
endfunction
10-02-2003, 09:15 PM#188
dataangel
Hey Lord Vexorian, what do those extra reals in SimError do, the ones that you pass to the display text function? I thought they might be for positioning the text but awhile ago when I experimented with it it made no difference. Does it work in TFT?
10-03-2003, 12:02 PM#189
Vexorian
I use TFT, and when I tested the function the text showed at the same x position as the error messages, the negative y value didn't work, it seems like a limit for the text.
10-12-2003, 05:17 PM#190
dataangel
*Bump*

Still need a PHP/MySql guy to set this up :/
10-13-2003, 08:25 PM#191
Starcraftfreak
Why don't make a forum as temporary solution?
10-13-2003, 08:51 PM#192
KaTTaNa
I'm not a PHP/MySQL expert, but I'm fairly experienced with it, and I think I should be able to create a site where you can search functions by return type, author and name.
What exactly should it be capable of? I might want to help you with this if you still need it.

NOTE: No promises as of yet, just asking.
10-15-2003, 10:57 PM#193
dataangel
Looks like Kattana is gonna help, our PMs have been fruitful =)

With any luck we can have this working soon ^_^
10-16-2003, 12:08 PM#194
KaTTaNa
Look at it here!!

http://kattana.users.whitehat.dk

:D
10-16-2003, 01:18 PM#195
PitzerMike
LOL When I register it says "you are now registered and can NOT log in"

I think it should be now instead of not:D

Is anyone going to submit all the functions we have collected by now?