Snippet DebugXYF

SanKakU

Member
Reaction score
21
This is very experimental code. With that said, I don't think it's dangerous. :D

JASS:
/*snippet by SanKakU*/

library DebugXYF uses optional MSGS

//A FAST WAY TO FIND ALL THE SPELLS YOU ARE DEBUGGING IS TO MAKE THE
//PRIVATE CONSTANT BOOLEAN DebugMode=false
//Save your map, then you should get errors.  you will be directed to the
//triggers that are using these functions.
globals
private constant boolean DebugMode=true
endglobals
/*PLEASE NOTE:  IF YOU COPY THE BELOW SCOPE GiveOrderStringForUnitType 
FROM THIS LIBRARY, YOU CAN MAKE YOUR OWN.
IF YOU LOSE TRACK OF IT, JUST CHANGE THE ABOVE BOOLEAN TO false AND SAVE YOUR MAP.
YOU SHOULD BE TAKEN RIGHT TO WHERE IT IS.*/


static if DebugMode then

/*FUNCTION LIST
_______________
give order string
display x/y of item for 300 seconds
display x/y of unit for 300 seconds
display x/y of destructable for 300 seconds
display facing angle of unit for 300 seconds
display facing angle and x/y of unit for 300 seconds
display x/y of item for 5 seconds
display x/y of unit for 5 seconds
display x/y of destructable for 5 seconds
display facing angle of unit for 5 seconds
display facing angle and x/y of unit for 5 seconds
check rect/region of item
check rect/region of unit
check rect/region of destructable
check x/y of item (is it within bounds/is it within the rect)
check x/y of unit (is it within bounds/is it within the rect)
check x/y of destructable (is it within bounds/is it within the rect)
________________________________________________________________________
function gos takes string order, integer orderid returns nothing
function dxyi takes item x returns nothing
function dxyu takes unit x returns nothing
function dxyd takes destructable x returns nothing
function dfu takes unit x returns nothing
function dfxyu takes unit x returns nothing
function dxyis takes item x returns nothing
function dxyus takes unit x returns nothing
function dxyds takes destructable x returns nothing
function dfus takes unit x returns nothing
function dfxyus takes unit x returns nothing
function cri takes item x, rect y returns boolean
function cru takes unit x, rect y returns boolean
function crd takes destructable x, rect y returns boolean
function cxyi takes item x, real x1, real y1, real x2, real y2 returns boolean
function cxyu takes unit x, real x1, real y1, real x2, real y2 returns boolean
function cxyd takes destructable x, real x1, real y1, real x2, real y2 returns boolean
______________________
END OF FUNCTION LIST*/

/*OPTIONAL SECTION
________________*/
static if LIBRARY_MSGS then
else
function msgall5 takes string s returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,5,s)
set i = i + 1
exitwhen i > 11
endloop
endfunction
function msgall300 takes string s returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,300,s)
set i = i + 1
exitwhen i > 11
endloop
endfunction
endif
/*END OF OPTIONAL SECTION
_______________________*/


function gos takes string order, integer orderid returns nothing
call msgall5(order)
call msgall5(I2S(orderid))
endfunction

//you might want to export the following example
//make another trigger, called GiveOrderStringForUnitType and copy this scope to there
//don't forget to take off the /* and */ characters to remove it's status as a comment
/*scope GiveOrderStringForUnitType initializer I

//to debug dummy units or possibly your heroes, change the 
//private constant integer UNITID=YourDummyOrHeroUnitId
globals
private constant integer UNITID='uloc'
endglobals

private function f takes nothing returns boolean
if GetUnitTypeId(GetOrderedUnit())==UNITID then
call msgall5("target order:")
call gos(OrderId2String(GetIssuedOrderId()),GetIssuedOrderId())
return false
else
return false
endif
endfunction
private function g takes nothing returns boolean
if GetUnitTypeId(GetOrderedUnit())==UNITID then
call msgall5("point order:")
call gos(OrderId2String(GetIssuedOrderId()),GetIssuedOrderId())
return false
else
return false
endif
endfunction
private function h takes nothing returns boolean
if GetUnitTypeId(GetOrderedUnit())==UNITID then
call msgall5("order:")
call gos(OrderId2String(GetIssuedOrderId()),GetIssuedOrderId())
return false
else
return false
endif
endfunction
private function I takes nothing returns nothing
local trigger t = CreateTrigger(  )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( t,Condition( function f))
set t = CreateTrigger(  )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddCondition( t,Condition( function g))
set t = CreateTrigger(  )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t,Condition( function h))
endfunction
endscope*/


//this is where all the display xy stuff is at
//this displays the exact x and y coordinates
//of an item
function dxyi takes item x returns nothing
call msgall300(R2S(GetItemX(x))+","+R2S(GetItemY(x)))
endfunction
//of a unit
function dxyu takes unit x returns nothing
call msgall300(R2S(GetUnitX(x))+","+R2S(GetUnitY(x)))
endfunction
//of a destructable
function dxyd takes destructable x returns nothing
call msgall300(R2S(GetDestructableX(x))+","+R2S(GetDestructableY(x)))
endfunction
//displays the facing angle of a unit
function dfu takes unit x returns nothing
call msgall300(R2S(GetUnitFacing(x)))
endfunction
//displays both the x and y coordinates of a unit and the facing angle
function dfxyu takes unit x returns nothing
call msgall300(R2S(GetUnitX(x))+","+R2S(GetUnitY(x))+","+R2S(GetUnitFacing(x)))
endfunction
//end of standard verification functions
//the above functions are available for spell debugging also, 5 second messages instead of
//the mass collection style of 300 seconds
function dxyis takes item x returns nothing
call msgall5(R2S(GetItemX(x))+","+R2S(GetItemY(x)))
endfunction
function dxyus takes unit x returns nothing
call msgall5(R2S(GetUnitX(x))+","+R2S(GetUnitY(x)))
endfunction
function dxyds takes destructable x returns nothing
call msgall5(R2S(GetDestructableX(x))+","+R2S(GetDestructableY(x)))
endfunction
function dfus takes unit x returns nothing
call msgall5(R2S(GetUnitFacing(x)))
endfunction
function dfxyus takes unit x returns nothing
call msgall5(R2S(GetUnitX(x))+","+R2S(GetUnitY(x))+","+R2S(GetUnitFacing(x)))
endfunction

endif

/*Snippet Extension by SanKakU*/

//example:
/*
make a timer run every 1 second of game time.
then make it check
if cru(somespecialunit,somespecialregion) then
...do your thing.

or better yet...
a unit drops an item...(using GT) 
if cri(GetManipulatedItem(),thestash) then
probably pull up some more conditions and make a recipe, or something like that.

it could also be used to remove items that are cluttering up the map if there are lots
of creeps and item drops on your map.
for example...
a unit drops an item...(using GT) 
run a timer for 2 minutes, then check
if cri(GetManipulatedItem(),thebattlefield) then
remove the item.
these are just a few ideas off the top of my head.
*/

//use this function to check if an item is in a box/rect/region
function cxyi takes item x, real x1, real y1, real x2, real y2 returns boolean
if GetItemX(x) > x1 and GetItemX(x) < x2 and GetItemY(x) > y1 and GetItemY(x) < y2 then
return true
endif
return false
endfunction
//this one is same as above, but for a unit
function cxyu takes unit x, real x1, real y1, real x2, real y2 returns boolean
if GetUnitX(x) > x1 and GetUnitX(x) < x2 and GetUnitY(x) > y1 and GetUnitY(x) < y2 then
return true
endif
return false
endfunction
//this one is same as above, but for a destructable
function cxyd takes destructable x, real x1, real y1, real x2, real y2 returns boolean
if GetDestructableX(x) > x1 and GetDestructableX(x) < x2 and GetDestructableY(x) > y1 and GetDestructableY(x) < y2 then
return true
endif
return false
endfunction
//use this function to check if an item is in a box/rect/region
//you only give the item and the rect (region), no xyxy like the above functions
function cri takes item x, rect y returns boolean
if GetItemX(x) > GetRectMinX(y) and GetItemX(x) < GetRectMaxX(y) and GetItemY(x) > GetRectMinY(y) and GetItemY(x) < GetRectMaxY(y) then
return true
endif
return false
endfunction
//use this function to check if a unit is in a box/rect/region
//you only give the item and the rect, no xyxy like the above functions
function cru takes unit x, rect y returns boolean
if GetUnitX(x) > GetRectMinX(y) and GetUnitX(x) < GetRectMaxX(y) and GetUnitY(x) > GetRectMinY(y) and GetUnitY(x) < GetRectMaxY(y) then
return true
endif
return false
endfunction
//use this function to check if a destructable is in a box/rect/region
//you only give the item and the rect, no xyxy like the above functions
function crd takes destructable x, rect y returns boolean
if GetDestructableX(x) > GetRectMinX(y) and GetDestructableX(x) < GetRectMaxX(y) and GetDestructableY(x) > GetRectMinY(y) and GetDestructableY(x) < GetRectMaxY(y) then
return true
endif
return false
endfunction

endlibrary
 

BlackRose

Forum User
Reaction score
239
You really need to make your posts more readeable.

And it's not that hard to just open up the mapscript and look yourself. Besides, who needs super accuracy, just hover your mouse over the unit is enough. Then again, I probably read it wrong, seeing as it is just so hard to read.
 

SanKakU

Member
Reaction score
21
what is this doable in gui nonsense you're spitting at me?

i created functions, for the purpose of debugging. of course it's doable in gui, that's not the point!

do you want me to release a gui version? i tell you now, you can't make a system for this in gui. why not? because gui doesn't have systems! so don't spit at me that this is doable in gui...you're not making any sense.

creating these functions...something NOT possible in gui...

enables you to do something MUCH MORE EXPEDIENTLY THAN IF YOU WERE TO DO IT IN GUI!!

BJDebugMsg("some string")
lasts for 60 seconds.

didn't you read my snippet? don't trash things before you read them, jerk.

callmsg300 lasts for FIVE MINUTES.

that is from my library.

the snippet, WHICH IS THIS BABY...

what does it do? it calls that.
you type in the function,
call dxyu(unitvariable)
and that's it.
nothing more to it.
it's unbelievably simple and i don't want you telling me that you can do that in gui. if you can create a function in gui, i'd like to see it. last i checked, you can't. so don't spit that nonsense at me.

You really need to make your posts more readeable.

And it's not that hard to just open up the mapscript and look yourself. Besides, who needs super accuracy, just hover your mouse over the unit is enough. Then again, I probably read it wrong, seeing as it is just so hard to read.

you might have a point about opening up the mapscript, but accuracy is a pretty big deal, regardless.

anyway, you can also use it in your spells to check the math of what you're doing. i think that's a cool idea, too.
 

BlackRose

Forum User
Reaction score
239
Something like this is much easier, it MAKES your system useless. What if you wanted to get the X/Y of every unit and had like 50 units? The new messages would push up the others. And as for destructables, simply have a unit cast a spell that targets destructables / items and display X/Y of target widget(?).

[Leak's but who cares, if the purpose is for debugging, it won't matter]

Trigger:
  • DebugXYF
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (OBJECT X: + (String((X of (Position of (Random unit from (Units currently selected by (Triggering player))))))))
      • Game - Display to (All players) the text: (OBJECT Y: + (String((Y of (Position of (Random unit from (Units currently selected by (Triggering player))))))))


--

You also need to clean up your posts, they are a mess:
i created functions, for the purple of debugging

do you want me to release a gui version? i tell you now, you can't make a system for this in gui. why not? because gui doesn't have systems! so don't spit at me that this is doable in gui...you're not making any sense.

Do you know what a system is? A system is not just [ljass]call DoThis()[/ljass]. Systems do stuff.

it's unbelievably simple and i don't want you telling me that you can do that in gui.

If it's so unbeilevably simple, why can't simple things be made in GUI?

anyway, you can also use it in your spells to check the math of what you're doing. i think that's a cool idea, too.

Nice to see you support that, examples?
 

SanKakU

Member
Reaction score
21
"What if you wanted to get the X/Y of every unit and had like 50 units? The new messages would push up the others."

use timers.

and with callbacks in structs with timers, you can at that time make the display x and y calls.

"[Leak's but who cares, if the purpose is for debugging, it won't matter]

Trigger:
  • DebugXYF
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (OBJECT X: + (String((X of (Position of (Random unit from (Units currently selected by (Triggering player))))))))
      • Game - Display to (All players) the text: (OBJECT Y: + (String((Y of (Position of (Random unit from (Units currently selected by (Triggering player))))))))
"

nothing close to what i wrote, but i suppose you're calling that your start.

"You also need to clean up your posts, they are a mess:"

lol, thanks.

"If it's so unbeilevably simple, why can't simple things be made in GUI?"

i'm saying it's simple to USE, systems are simple to use. i didn't say the system itself was simple. obviously i could add more to the system, and i just thought of something just a little while ago, in fact. i'll add it soon.

"Nice to see you support that, examples?"

i'll post something soon. and i really don't think you should take yourself seriously about trying to create the system in gui. i think j4l was drunk when he typed that :/
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
wad ._.
I don't get what the snippet really does =x

It tells me a unit's/destructable's/item's X-Y Co-ordinates on a map..
What purpose does that serve? o.0

For checking if something is in a region/rect..
Why can't you just do this:

it will only take a unit/destructable/item and rect..

JASS:
local region REGION = CreateRegion()

call RegionAddRect(//Stuff, gg_rct_IsMyUnitInHere)

if IsPointInRegion(//Stuff) then
    //Do stuff
endif

//Clear leaks w/e
 

Jesus4Lyf

Good Idea™
Reaction score
397
what is this doable in gui nonsense you're spitting at me?
What I mean is the same functionality is achievable without JASS. :thup:
creating these functions...something NOT possible in gui...
The stated purpose of this system is to:
JASS:
/*display x and y of widget/object
this is mainly for reproducing terrain
placed objects by triggering them*/

not to create functions. The goal of your system is achievable with merely GUI.
BJDebugMsg("some string")
lasts for 60 seconds.

didn't you read my snippet? don't trash things before you read them, jerk.

callmsg300 lasts for FIVE MINUTES.
Lasting for 5 minutes is not a stated goal of the system, nor does it appear to serve a purpose. Be mature about your responses, please. Moderators try their hardest to promote a healthy library repository, which involves making judgments about what is worth keeping there. I did read your system before reviewing it, and concluded that there were better ways to achieved the desired effects (like hovering your mouse over the terrain in the editor and reading the x/y locations for it from the bottom of the screen - hey, you can even use a calculator to round it off to the nearest 64 units :)).

Debug message libraries are not really adding much functionality to WC3. Everyone has their own perspectives on what they should be used for, and hence everyone should just write their own. They are not generally considered submittable material, mostly because they are faster to write on your own than to look up on a website.

Furthermore, any resource moderator is capable of restoring a resource from the graveyard, as is stated in the submission rules. If this gains content for which it can be approved, it will be restored.
 

SanKakU

Member
Reaction score
21
What I mean is the same functionality is achievable without JASS. :thup:
>and i'm telling you that is simply not the case. if it were, i wouldn't start writing this, would i? maybe the snippet is too small for you to understand, but eh...i haven't used your snippet either. that doesn't mean i won't. i just haven't figured out how to use it, yet. the same goes for you.

JASS:
//== snippet by Jesus4Lyf
//== think this is surprisingly useful.
//==
//==The "from" unit is the center of reference for
//== setting the position of the "to" unit.
//== The "dist" real is the distance to set between the units. 
//== So if you wanted a spell where a unit walks along pushing
//== all units out of the way, you would, for each unit in 
//== &quot;dist&quot; range, call SetDistanceToUnit(pusher, pickedUnit, dist). <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" /> 
function SetDistanceToUnit takes unit from, unit to, real dist returns nothing
    local real x=GetUnitX(to)-GetUnitX(from)
    local real y=GetUnitY(to)-GetUnitY(from)
    local real factor=dist/SquareRoot(x*x+y*y)
    call SetUnitX(to,GetUnitX(from)+x*factor)
    call SetUnitY(to,GetUnitY(from)+y*factor)
endfunction
function SetDistanceToXY takes real x, real y, unit to, real dist returns nothing
    local real tx=GetUnitX(to)-x
    local real ty=GetUnitY(to)-y
    local real factor=dist/SquareRoot(tx*tx+ty*ty)
    call SetUnitX(to,x+tx*factor)
    call SetUnitY(to,y+ty*factor)
endfunction
//==Hopefully this inspires some creativity.
//==end of snippet


Lasting for 5 minutes is not a stated goal of the system, nor does it appear to serve a purpose.
>it serves a purpose. i already explained the purpose. although you might have to read it again, as it was pointed out to me that i used the word 'purple'.

Be mature about your responses, please. Moderators try their hardest to promote a healthy library repository, which involves making judgments about what is worth keeping there. I did read your system before reviewing it, and concluded that there were better ways to achieved the desired effects (like hovering your mouse over the terrain in the editor and reading the x/y locations for it from the bottom of the screen - hey, you can even use a calculator to round it off to the nearest 64 units :)).
>and i disagree. hovering your mouse over the terrain isn't mathematical enough. and why are you suggesting to do something as absurd as using a calculator as a means of rounding? was that a joke? i guess so...


Debug message libraries are not really adding much functionality to WC3. Everyone has their own perspectives on what they should be used for, and hence everyone should just write their own. They are not generally considered submittable material, mostly because they are faster to write on your own than to look up on a website.
>hmm...i'm going to continue to make wc3 games. when sc2 comes out, i'll definitely get started on making sc2 games. but for now, wc3 is the game i'm playing, it's the game i'm coding with. i don't think you should shove your modern standards of functionality on other people.

Furthermore, any resource moderator is capable of restoring a resource from the graveyard, as is stated in the submission rules. If this gains content for which it can be approved, it will be restored.
> :) actually, i really don't mind it being graveyarded. but i do admit to being quite insulted at how quickly it ended up in there. it just goes to show you that there's some nice stuff in there and it can pay to browse it.
 

BlackRose

Forum User
Reaction score
239
1) Learn to quote.
2) Someone make a poll saying "WOULD YOU USE DEBUGXYF"... see how many yes you get.
 

cleeezzz

The Undead Ranger.
Reaction score
268
i dont know if you've thought of this, but in order to use a system like this to replicate preplaced doodads/units/items, the user will have to

1) Select all items/doodads/units using Enums in Rect
2) Create a periodic timer
3) Call your function

All 3 steps done in JASS

if the user has enough JASS knowledge to accomplish these three steps, there is no doubt that he/she can write his/her own debug message.

EDIT: Then again... i haven't seen anyone say this yet but if you extract your war3map.j you can get all the preplaced data and just copy that. This will save you hours.. literally

too bad war3map doesn't contain doodad locations however. Although it might be saved somewhere else, anyone know?
 

SanKakU

Member
Reaction score
21
i appreciate the concern blackrose but i'm planning on updating it a bunch before i would do a poll like that. and possibly renaming it.

cleeezzz, i appreciate the thoughtful input, and for being the first person to respond while bearing a lack of insults, besides kingkingyyk3 i guess.

and yeah, i used those functions before i realized i could do that. at any rate i just wrote some other functions that i haven't added which also accomplish something i didn't know how to before i wrote them. you'll understsand when i post the functions.

but it'll prbably bea while before then because i'm busy with some other stuff in my map and am not really concerned with the aspect of adding those functions to it since i've only used them once and haven't tested their usefulness yet.
 

tooltiperror

Super Moderator
Reaction score
231
Let's try this.

1) Indent a little, please. I know you say that you don't like to, but it's very hard to read without indenting.

2) I know it's bad, and I do it to, but we should be using the native instead of the BJ, saves a function call. Just coding practice.
JASS:
native DisplayTimedTextToPlayer     takes player toPlayer, real x, real y, real duration, string message returns nothing


3) Perhaps a better system would be one that makes it easier to make terrain with triggers.
 

SanKakU

Member
Reaction score
21
Let's try this.

1) Indent a little, please. I know you say that you don't like to, but it's very hard to read without indenting.

2) I know it's bad, and I do it to, but we should be using the native instead of the BJ, saves a function call. Just coding practice.
JASS:
native DisplayTimedTextToPlayer     takes player toPlayer, real x, real y, real duration, string message returns nothing


3) Perhaps a better system would be one that makes it easier to make terrain with triggers.

1:
don't mention it.
2:
i believe you are wrong.
3:
not really interested in such a thing.
 

Flare

Stops copies me!
Reaction score
662
Hmmm, I'm a little perplexed as to what this would add to a JASS user's 'repetoire', as it were; to me, this seems as though it's just your typical debugging stuff, but with some additional fluff.

JASS scripts should add something that is desirable for the end-user, be it some sort of gameplay system, a spell, or simply something to allow you to 'manage' various internal bits and pieces (I can't think of a better way of phrasing it) - while it may add some convenience to the debugging process, I personally believe that the function names don't help you achieve that aim (if that is your aim).

The functions should have sensible names (personally, I think they should clearly, yet briefly, state their functionality) and abbreviating them to the least possible letters makes it terribly confusing - I may get a function dedicated to providing a particular piece of information, but if I have to return to the script to find the function name again (because, from where I'm sitting, they are all very similar), some of the time I may have saved by using these functions is then lost by having to check the function name.

As TooltipError said, indentation would be great; it makes the code appear much more orderly, and easier to read - it's difficult to read code if it's all on the same 'level' and, given the nature of the script I hope you would appreciate this point, it aids in debugging since being able to clearly read code makes it easier to identify flaws in the code.

1) Learn to quote.
This serves no purpose in this thread, whatsoever - the thread is about the snippet posted in the first post, so that should be the point of discussion :)

3) Perhaps a better system would be one that makes it easier to make terrain with triggers.
Er... what does that have to do with this system/snippet?

So, as a last word for now... keep your responses constructive and on-topic
 

SanKakU

Member
Reaction score
21
JASS scripts should add something that is desirable for the end-user, be it some sort of gameplay system, a spell, or simply something to allow you to 'manage' various internal bits and pieces (I can't think of a better way of phrasing it) - while it may add some convenience to the debugging process, I personally believe that the function names don't help you achieve that aim (if that is your aim).

The functions should have sensible names (personally, I think they should clearly, yet briefly, state their functionality) and abbreviating them to the least possible letters makes it terribly confusing - I may get a function dedicated to providing a particular piece of information, but if I have to return to the script to find the function name again (because, from where I'm sitting, they are all very similar), some of the time I may have saved by using these functions is then lost by having to check the function name.

I did give this some thought. But I'm sure if anyone likes this debug stuff they can rename the functions as it pleases them. As it is, that's the way I prefer to leave them named. The comments already explain what the functions are. I think the way I named them is easy enough to memorize, and I like these debug functions because they take less time to implement since a line can be as short as:
[ljass]call dfxyus(d.targ)[/ljass] which will display both the facing real of d.targ(the target of a spell in a struct) and the x and y coordinates of that unit. It is my finding that short and sweet lines and no indentation lead to faster code reading and faster code reading leads to faster flaw indentifying.

As TooltipError said, indentation would be great; it makes the code appear much more orderly, and easier to read - it's difficult to read code if it's all on the same 'level' and, given the nature of the script I hope you would appreciate this point, it aids in debugging since being able to clearly read code makes it easier to identify flaws in the code.

I'm not sure you understand the aim of this script. While it is important to identify flaws in the code, the quickest way to do that is by using debug functions such as these in a test run. These functions that I wrote have no bearing at all on the way other people write their code. In my opinion, someone who relies too heavily on indenting is at a disadvantage. The steps involved in identifying flaws in code have nothing to do with indentation. Compilation and test runs disregard indentation completely.

Regardless of my opinion, how I wrote the functions(regarding using indentation or not) is irrelevant, as it has nothing to do with the way others write their code. The only relation there is between the code I wrote and the code others have is as you have already mentioned, good names for the functions to be called.

I have submitted quite a few resources that have been regarded as junk. If this is another piece of junk, what's the point in changing function names that the user can do himself? It does nothing to upgrade the junk. If anything, I'm downgrading the code when I do that. Although that's obviously just my assesment. I'm not saying I'm being fair in it.

At any rate, I think this resource should be ignored for the most part because I combined this DebugXYF with MSGS.

I am certainly thinking about ways to improve MSGS.

Here is the code I am currently using inside which you should see the library DebugXYF at the bottom.
As you can see, this is the TAF version. It is so far incomplete. Please continue discussion in the MSGS thread, not this one.
JASS:
/*
______________________________________________
MSGS - MessageS
MessageSystem by SanKakU
Requirements:
Newest Version of Jasshelper
Optional:
TAF
MainMapLibrary
_______________________________________
Function List
_______________________________________
library required: (optional)
________________________________________________________________________________
function msgally$integer$ takes player p, string s, boolean ally returns nothing
//msgally$integer$ is great for separate messages to both teams quickly.
for example:
call msgally15(GetOwningPlayer(DominatingUnit),&quot;Your team is dominating! Woohoo!&quot;,true)
call msgally40(GetOwningPlayer(DominatingUnit),&quot;Your team is failing! Pick up the slack!&quot;,false)
_______________________________________
Primary Functions:
_______________________________________
function msgtwo$integer$ takes player p1, string s1, player p2, string s2, boolean two returns nothing
//msgtwo$integer$ is a little bit advanced and isn&#039;t for everyone...
//i&#039;m actually thinking of recoding it so that it&#039;s easier to use.
function msgone$integer$ takes player p, string s, boolean one returns nothing
//this one isn&#039;t so much a team message so much as an independant message
//you send it to the one player, and optionally to everyone else
//it&#039;s well suited for ffa style maps
for example:
call msgone10(GetOwningPlayer(DominatingUnit),&quot;You just found a potion!&quot;,true)
call msgone25(GetOwningPlayer(DominatingUnit),GetUnitName(DominatingUnit)+&quot;Has killed over 200 enemies!&quot;,false)
function msgall$integer$ takes string s returns nothing
//this is for displaying messages to all players.  it&#039;s for general map announcements or for
//testing or debugging purposes.  for ideas on how to get the most out of this function,
//see the library DebugXYF
_________________________________________________________________________
//keep in mind that with all the the msg_____ functions, because of the textmacro, the duration
//is the 1-3 digit number divisible by 5 from 5-300 of your own choosing.
_________________________________________________________________________
//msgall$integer$ only takes a single field, and so it&#039;s very convenient
//it&#039;s basically like BJDebugMsg combined with DisplayTimedTextToPlayer, in a sensible way.
_________________________________________________ 
*/

library MSGS uses optional TAF, optional MainMapLibrary

/*OPTIONAL SECTION
________________*/
static if LIBRARY_TAF then
//! textmacro tmdma takes integer
function msgally$integer$ takes player p, string s, boolean ally returns nothing
local integer ip = GetPlayerSlotMultiboard(GetPlayerId(p))
/*so, why do we make a local integer ip = GetPlayerSlotMultiboard(GetPlayerId(p)) ?
it is so we can say, if ip&gt;5 then
that way the code is nice and clean.
why did TAF do this?
well, think about it for a little bit.
isn&#039;t it interesting that in DotA, blue and pink are on opposite teams?
or blue and brown?  well, with a function like GetPlayerSlotMultiboard,
you can put whatever color player on whatever color player&#039;s team.
and you don&#039;t have to worry too much about the details.  just a simple
if ip&gt;5 then he must be on team 2, else, he&#039;s on team 1.
alternatively, you can use if ip&lt;6 then he must be on team 1, and so on.
this is just the example of how it is at TAF.
function GetPlayerSlotMultiboard takes integer playerid returns integer
if playerid==0 then
return 10
elseif playerid==1 then
return 11
elseif playerid==2 then
return 0
elseif playerid==3 then
return 5
elseif playerid==4 then
return 1
elseif playerid==5 then
return 6
elseif playerid==6 then
return 2
elseif playerid==7 then
return 7
elseif playerid==8 then
return 3
elseif playerid==9 then
return 8
elseif playerid==10 then
return 4
elseif playerid==11 then
return 9
endif
return 12
endfunction
*/
if ally then//this responds to true or false in the function call
//if false, it means the message is sent to the enemies of the player
//this effectively means you only need a single player variable and just two function calls
//if this is too confusing for you, just don&#039;t use this section of the library
//static if exists for a reason
if ip &gt;5 then
call DisplayTimedTextToPlayer(Player(2),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(4),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(6),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(10),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(8),0,0,$integer$,s)
else//if not on team 2, we know the player listed in the function call is on team 1, so send
//the message to team 1 instead of team 2 in this scenario
//Player(0) and Player(1) are computer players, and we don&#039;t care if they don&#039;t get messages
call DisplayTimedTextToPlayer(Player(5),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(3),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(7),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(9),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(11),0,0,$integer$,s)
endif
elseif ip &gt;5 then//now we found out you listed false in the function call, here we go again
//since the message is NOT being sent to the player&#039;s allies, if he&#039;s on team 2,
//we send the message to team 1
call DisplayTimedTextToPlayer(Player(5),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(3),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(7),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(9),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(11),0,0,$integer$,s)
else//if the player is on team 1, we send the message to team 2
//Player(0) and Player(1) are computer players, and we don&#039;t care if they don&#039;t get messages
call DisplayTimedTextToPlayer(Player(2),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(4),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(6),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(10),0,0,$integer$,s)
call DisplayTimedTextToPlayer(Player(8),0,0,$integer$,s)
endif
endfunction
//! endtextmacro
//! runtextmacro tmdma(&quot;5&quot;)
//! runtextmacro tmdma(&quot;10&quot;)
//! runtextmacro tmdma(&quot;15&quot;)
//! runtextmacro tmdma(&quot;20&quot;)
//! runtextmacro tmdma(&quot;25&quot;)
//! runtextmacro tmdma(&quot;30&quot;)
//! runtextmacro tmdma(&quot;35&quot;)
//! runtextmacro tmdma(&quot;40&quot;)
//! runtextmacro tmdma(&quot;45&quot;)
//! runtextmacro tmdma(&quot;50&quot;)
//! runtextmacro tmdma(&quot;55&quot;)
//! runtextmacro tmdma(&quot;60&quot;)
//! runtextmacro tmdma(&quot;65&quot;)
//! runtextmacro tmdma(&quot;70&quot;)
//! runtextmacro tmdma(&quot;75&quot;)
//! runtextmacro tmdma(&quot;80&quot;)
//! runtextmacro tmdma(&quot;85&quot;)
//! runtextmacro tmdma(&quot;90&quot;)
//! runtextmacro tmdma(&quot;95&quot;)
//! runtextmacro tmdma(&quot;100&quot;)
//! runtextmacro tmdma(&quot;105&quot;)
//! runtextmacro tmdma(&quot;110&quot;)
//! runtextmacro tmdma(&quot;115&quot;)
//! runtextmacro tmdma(&quot;120&quot;)
//! runtextmacro tmdma(&quot;125&quot;)
//! runtextmacro tmdma(&quot;130&quot;)
//! runtextmacro tmdma(&quot;135&quot;)
//! runtextmacro tmdma(&quot;140&quot;)
//! runtextmacro tmdma(&quot;145&quot;)
//! runtextmacro tmdma(&quot;150&quot;)
//! runtextmacro tmdma(&quot;155&quot;)
//! runtextmacro tmdma(&quot;160&quot;)
//! runtextmacro tmdma(&quot;165&quot;)
//! runtextmacro tmdma(&quot;170&quot;)
//! runtextmacro tmdma(&quot;175&quot;)
//! runtextmacro tmdma(&quot;180&quot;)
//! runtextmacro tmdma(&quot;185&quot;)
//! runtextmacro tmdma(&quot;190&quot;)
//! runtextmacro tmdma(&quot;195&quot;)
//! runtextmacro tmdma(&quot;200&quot;)
//! runtextmacro tmdma(&quot;205&quot;)
//! runtextmacro tmdma(&quot;210&quot;)
//! runtextmacro tmdma(&quot;215&quot;)
//! runtextmacro tmdma(&quot;220&quot;)
//! runtextmacro tmdma(&quot;225&quot;)
//! runtextmacro tmdma(&quot;230&quot;)
//! runtextmacro tmdma(&quot;235&quot;)
//! runtextmacro tmdma(&quot;240&quot;)
//! runtextmacro tmdma(&quot;245&quot;)
//! runtextmacro tmdma(&quot;250&quot;)
//! runtextmacro tmdma(&quot;255&quot;)
//! runtextmacro tmdma(&quot;260&quot;)
//! runtextmacro tmdma(&quot;265&quot;)
//! runtextmacro tmdma(&quot;270&quot;)
//! runtextmacro tmdma(&quot;275&quot;)
//! runtextmacro tmdma(&quot;280&quot;)
//! runtextmacro tmdma(&quot;285&quot;)
//! runtextmacro tmdma(&quot;290&quot;)
//! runtextmacro tmdma(&quot;295&quot;)
//! runtextmacro tmdma(&quot;300&quot;)
endif
static if LIBRARY_MainMapLibrary then
//insert your own tmdma textmacro
endif
/*END OF OPTIONAL SECTION
_______________________*/

//! textmacro tmdmtp takes integer
//you would usually use this function for addressing the players both involved in a special event
//like for example, a player&#039;s hero kills the hero of another player, or maybe he steals some gold
//the boolean if true would make the message display to them, and false display to everyone else
//with these boolean functions, you can display two different message to both players with one
// call, and with an additional call, display a message to everyone else, utilizing two strings
//example:
/*
call msgtwo35(GetOwningPlayer(GetTriggerUnit()),&quot;You got owned by &quot;+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+&quot;!&quot;,GetOwningPlayer(GetKillingUnit()),&quot;You just dominated &quot;+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+&quot;!&quot;,true)
call msgtwo35(GetOwningPlayer(GetTriggerUnit()),GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+&quot; just got owned by &quot;,GetOwningPlayer(GetKillingUnit()),GetPlayerName(GetOwningPlayer(GetKillingUnit()))+&quot;!&quot;,false)
*/
function msgtwo$integer$ takes player p1, string s1, player p2, string s2, boolean two returns nothing
local integer i = 0
local integer ip1 = GetPlayerId(p1)
local integer ip2 = GetPlayerId(p2)
if two then
call DisplayTimedTextToPlayer(p1,0,0,$integer$,s1)
call DisplayTimedTextToPlayer(p2,0,0,$integer$,s2)
else
loop
if i == ip1 then
set i = i + 1
elseif i == ip2 then
set i = i + 1
else
call DisplayTimedTextToPlayer(Player(i),0,0,$integer$,s1+s2)//if you want, you can just delete either s1 or s2 at this point if you don&#039;t care for submitting two halves in the function call
set i = i + 1
endif
exitwhen i &gt; 11
endloop
endif
endfunction
//! endtextmacro
//! runtextmacro tmdmtp(&quot;5&quot;)
//! runtextmacro tmdmtp(&quot;10&quot;)
//! runtextmacro tmdmtp(&quot;15&quot;)
//! runtextmacro tmdmtp(&quot;20&quot;)
//! runtextmacro tmdmtp(&quot;25&quot;)
//! runtextmacro tmdmtp(&quot;30&quot;)
//! runtextmacro tmdmtp(&quot;35&quot;)
//! runtextmacro tmdmtp(&quot;40&quot;)
//! runtextmacro tmdmtp(&quot;45&quot;)
//! runtextmacro tmdmtp(&quot;50&quot;)
//! runtextmacro tmdmtp(&quot;55&quot;)
//! runtextmacro tmdmtp(&quot;60&quot;)
//! runtextmacro tmdmtp(&quot;65&quot;)
//! runtextmacro tmdmtp(&quot;70&quot;)
//! runtextmacro tmdmtp(&quot;75&quot;)
//! runtextmacro tmdmtp(&quot;80&quot;)
//! runtextmacro tmdmtp(&quot;85&quot;)
//! runtextmacro tmdmtp(&quot;90&quot;)
//! runtextmacro tmdmtp(&quot;95&quot;)
//! runtextmacro tmdmtp(&quot;100&quot;)
//! runtextmacro tmdmtp(&quot;105&quot;)
//! runtextmacro tmdmtp(&quot;110&quot;)
//! runtextmacro tmdmtp(&quot;115&quot;)
//! runtextmacro tmdmtp(&quot;120&quot;)
//! runtextmacro tmdmtp(&quot;125&quot;)
//! runtextmacro tmdmtp(&quot;130&quot;)
//! runtextmacro tmdmtp(&quot;135&quot;)
//! runtextmacro tmdmtp(&quot;140&quot;)
//! runtextmacro tmdmtp(&quot;145&quot;)
//! runtextmacro tmdmtp(&quot;150&quot;)
//! runtextmacro tmdmtp(&quot;155&quot;)
//! runtextmacro tmdmtp(&quot;160&quot;)
//! runtextmacro tmdmtp(&quot;165&quot;)
//! runtextmacro tmdmtp(&quot;170&quot;)
//! runtextmacro tmdmtp(&quot;175&quot;)
//! runtextmacro tmdmtp(&quot;180&quot;)
//! runtextmacro tmdmtp(&quot;185&quot;)
//! runtextmacro tmdmtp(&quot;190&quot;)
//! runtextmacro tmdmtp(&quot;195&quot;)
//! runtextmacro tmdmtp(&quot;200&quot;)
//! runtextmacro tmdmtp(&quot;205&quot;)
//! runtextmacro tmdmtp(&quot;210&quot;)
//! runtextmacro tmdmtp(&quot;215&quot;)
//! runtextmacro tmdmtp(&quot;220&quot;)
//! runtextmacro tmdmtp(&quot;225&quot;)
//! runtextmacro tmdmtp(&quot;230&quot;)
//! runtextmacro tmdmtp(&quot;235&quot;)
//! runtextmacro tmdmtp(&quot;240&quot;)
//! runtextmacro tmdmtp(&quot;245&quot;)
//! runtextmacro tmdmtp(&quot;250&quot;)
//! runtextmacro tmdmtp(&quot;255&quot;)
//! runtextmacro tmdmtp(&quot;260&quot;)
//! runtextmacro tmdmtp(&quot;265&quot;)
//! runtextmacro tmdmtp(&quot;270&quot;)
//! runtextmacro tmdmtp(&quot;275&quot;)
//! runtextmacro tmdmtp(&quot;280&quot;)
//! runtextmacro tmdmtp(&quot;285&quot;)
//! runtextmacro tmdmtp(&quot;290&quot;)
//! runtextmacro tmdmtp(&quot;295&quot;)
//! runtextmacro tmdmtp(&quot;300&quot;)
//! textmacro tmdmop takes integer
//THIS TEXTMACRO WRITES THE FUNCTION TO DISPLAY TO A SINGLE PLAYER, HOWEVER, IF THE BOOLEAN
//IS FALSE, IT DISPLAYS NOT TO THAT PLAYER, BUT TO EVERYONE ELSE IN THE GAME INSTEAD
function msgone$integer$ takes player p, string s, boolean one returns nothing
local integer i = 0
local integer ip = GetPlayerId(p)
if one then
call DisplayTimedTextToPlayer(p,0,0,$integer$,s)
else
loop
if i == ip then
set i = i + 1
else
call DisplayTimedTextToPlayer(Player(i),0,0,$integer$,s)
set i = i + 1
endif
exitwhen i &gt; 11
endloop
endif
endfunction
//! endtextmacro
//! runtextmacro tmdmop(&quot;5&quot;)
//! runtextmacro tmdmop(&quot;10&quot;)
//! runtextmacro tmdmop(&quot;15&quot;)
//! runtextmacro tmdmop(&quot;20&quot;)
//! runtextmacro tmdmop(&quot;25&quot;)
//! runtextmacro tmdmop(&quot;30&quot;)
//! runtextmacro tmdmop(&quot;35&quot;)
//! runtextmacro tmdmop(&quot;40&quot;)
//! runtextmacro tmdmop(&quot;45&quot;)
//! runtextmacro tmdmop(&quot;50&quot;)
//! runtextmacro tmdmop(&quot;55&quot;)
//! runtextmacro tmdmop(&quot;60&quot;)
//! runtextmacro tmdmop(&quot;65&quot;)
//! runtextmacro tmdmop(&quot;70&quot;)
//! runtextmacro tmdmop(&quot;75&quot;)
//! runtextmacro tmdmop(&quot;80&quot;)
//! runtextmacro tmdmop(&quot;85&quot;)
//! runtextmacro tmdmop(&quot;90&quot;)
//! runtextmacro tmdmop(&quot;95&quot;)
//! runtextmacro tmdmop(&quot;100&quot;)
//! runtextmacro tmdmop(&quot;105&quot;)
//! runtextmacro tmdmop(&quot;110&quot;)
//! runtextmacro tmdmop(&quot;115&quot;)
//! runtextmacro tmdmop(&quot;120&quot;)
//! runtextmacro tmdmop(&quot;125&quot;)
//! runtextmacro tmdmop(&quot;130&quot;)
//! runtextmacro tmdmop(&quot;135&quot;)
//! runtextmacro tmdmop(&quot;140&quot;)
//! runtextmacro tmdmop(&quot;145&quot;)
//! runtextmacro tmdmop(&quot;150&quot;)
//! runtextmacro tmdmop(&quot;155&quot;)
//! runtextmacro tmdmop(&quot;160&quot;)
//! runtextmacro tmdmop(&quot;165&quot;)
//! runtextmacro tmdmop(&quot;170&quot;)
//! runtextmacro tmdmop(&quot;175&quot;)
//! runtextmacro tmdmop(&quot;180&quot;)
//! runtextmacro tmdmop(&quot;185&quot;)
//! runtextmacro tmdmop(&quot;190&quot;)
//! runtextmacro tmdmop(&quot;195&quot;)
//! runtextmacro tmdmop(&quot;200&quot;)
//! runtextmacro tmdmop(&quot;205&quot;)
//! runtextmacro tmdmop(&quot;210&quot;)
//! runtextmacro tmdmop(&quot;215&quot;)
//! runtextmacro tmdmop(&quot;220&quot;)
//! runtextmacro tmdmop(&quot;225&quot;)
//! runtextmacro tmdmop(&quot;230&quot;)
//! runtextmacro tmdmop(&quot;235&quot;)
//! runtextmacro tmdmop(&quot;240&quot;)
//! runtextmacro tmdmop(&quot;245&quot;)
//! runtextmacro tmdmop(&quot;250&quot;)
//! runtextmacro tmdmop(&quot;255&quot;)
//! runtextmacro tmdmop(&quot;260&quot;)
//! runtextmacro tmdmop(&quot;265&quot;)
//! runtextmacro tmdmop(&quot;270&quot;)
//! runtextmacro tmdmop(&quot;275&quot;)
//! runtextmacro tmdmop(&quot;280&quot;)
//! runtextmacro tmdmop(&quot;285&quot;)
//! runtextmacro tmdmop(&quot;290&quot;)
//! runtextmacro tmdmop(&quot;295&quot;)
//! runtextmacro tmdmop(&quot;300&quot;)
//! textmacro tmdmap takes integer
//THIS TEXTMACRO WRITES THE FUNCTION TO DISPLAY ALL PLAYERS.  THIS IS EXPECTED
//TO BE THE MOST USED TEXTMACRO IN THIS SYSTEM.  GENERAL ANNOUNCEMENTS, AND DEBUG
//MESSAGES ARE ALL ENHANCED BY THE SIMPLE INTERFACE.
function msgall$integer$ takes string s returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,$integer$,s)
set i = i + 1
exitwhen i &gt; 11
endloop
endfunction
//! endtextmacro
//! runtextmacro tmdmap(&quot;5&quot;)
//! runtextmacro tmdmap(&quot;10&quot;)
//! runtextmacro tmdmap(&quot;15&quot;)
//! runtextmacro tmdmap(&quot;20&quot;)
//! runtextmacro tmdmap(&quot;25&quot;)
//! runtextmacro tmdmap(&quot;30&quot;)
//! runtextmacro tmdmap(&quot;35&quot;)
//! runtextmacro tmdmap(&quot;40&quot;)
//! runtextmacro tmdmap(&quot;45&quot;)
//! runtextmacro tmdmap(&quot;50&quot;)
//! runtextmacro tmdmap(&quot;55&quot;)
//! runtextmacro tmdmap(&quot;60&quot;)
//! runtextmacro tmdmap(&quot;65&quot;)
//! runtextmacro tmdmap(&quot;70&quot;)
//! runtextmacro tmdmap(&quot;75&quot;)
//! runtextmacro tmdmap(&quot;80&quot;)
//! runtextmacro tmdmap(&quot;85&quot;)
//! runtextmacro tmdmap(&quot;90&quot;)
//! runtextmacro tmdmap(&quot;95&quot;)
//! runtextmacro tmdmap(&quot;100&quot;)
//! runtextmacro tmdmap(&quot;105&quot;)
//! runtextmacro tmdmap(&quot;110&quot;)
//! runtextmacro tmdmap(&quot;115&quot;)
//! runtextmacro tmdmap(&quot;120&quot;)
//! runtextmacro tmdmap(&quot;125&quot;)
//! runtextmacro tmdmap(&quot;130&quot;)
//! runtextmacro tmdmap(&quot;135&quot;)
//! runtextmacro tmdmap(&quot;140&quot;)
//! runtextmacro tmdmap(&quot;145&quot;)
//! runtextmacro tmdmap(&quot;150&quot;)
//! runtextmacro tmdmap(&quot;155&quot;)
//! runtextmacro tmdmap(&quot;160&quot;)
//! runtextmacro tmdmap(&quot;165&quot;)
//! runtextmacro tmdmap(&quot;170&quot;)
//! runtextmacro tmdmap(&quot;175&quot;)
//! runtextmacro tmdmap(&quot;180&quot;)
//! runtextmacro tmdmap(&quot;185&quot;)
//! runtextmacro tmdmap(&quot;190&quot;)
//! runtextmacro tmdmap(&quot;195&quot;)
//! runtextmacro tmdmap(&quot;200&quot;)
//! runtextmacro tmdmap(&quot;205&quot;)
//! runtextmacro tmdmap(&quot;210&quot;)
//! runtextmacro tmdmap(&quot;215&quot;)
//! runtextmacro tmdmap(&quot;220&quot;)
//! runtextmacro tmdmap(&quot;225&quot;)
//! runtextmacro tmdmap(&quot;230&quot;)
//! runtextmacro tmdmap(&quot;235&quot;)
//! runtextmacro tmdmap(&quot;240&quot;)
//! runtextmacro tmdmap(&quot;245&quot;)
//! runtextmacro tmdmap(&quot;250&quot;)
//! runtextmacro tmdmap(&quot;255&quot;)
//! runtextmacro tmdmap(&quot;260&quot;)
//! runtextmacro tmdmap(&quot;265&quot;)
//! runtextmacro tmdmap(&quot;270&quot;)
//! runtextmacro tmdmap(&quot;275&quot;)
//! runtextmacro tmdmap(&quot;280&quot;)
//! runtextmacro tmdmap(&quot;285&quot;)
//! runtextmacro tmdmap(&quot;290&quot;)
//! runtextmacro tmdmap(&quot;295&quot;)
//! runtextmacro tmdmap(&quot;300&quot;)
endlibrary

/*snippet by SanKakU*/

library DebugXYF uses optional MSGS

//A FAST WAY TO FIND ALL THE SPELLS YOU ARE DEBUGGING IS TO MAKE THE
//PRIVATE CONSTANT BOOLEAN DebugMode=false
//Save your map, then you should get errors.  you will be directed to the
//triggers that are using these functions.
globals
private constant boolean DebugMode=true
endglobals
/*PLEASE NOTE:  IF YOU COPY THE BELOW SCOPE GiveOrderStringForUnitType 
FROM THIS LIBRARY, YOU CAN MAKE YOUR OWN.
IF YOU LOSE TRACK OF IT, JUST CHANGE THE ABOVE BOOLEAN TO false AND SAVE YOUR MAP.
YOU SHOULD BE TAKEN RIGHT TO WHERE IT IS.*/


static if DebugMode then

/*FUNCTION LIST
_______________
give order string
display x/y of item for 300 seconds
display x/y of unit for 300 seconds
display x/y of destructable for 300 seconds
display facing angle of unit for 300 seconds
display facing angle and x/y of unit for 300 seconds
display x/y of item for 5 seconds
display x/y of unit for 5 seconds
display x/y of destructable for 5 seconds
display facing angle of unit for 5 seconds
display facing angle and x/y of unit for 5 seconds
check rect/region of item
check rect/region of unit
check rect/region of destructable
check x/y of item (is it within bounds/is it within the rect)
check x/y of unit (is it within bounds/is it within the rect)
check x/y of destructable (is it within bounds/is it within the rect)
________________________________________________________________________
function gos takes string order, integer orderid returns nothing
function dxyi takes item x returns nothing
function dxyu takes unit x returns nothing
function dxyd takes destructable x returns nothing
function dfu takes unit x returns nothing
function dfxyu takes unit x returns nothing
function dxyis takes item x returns nothing
function dxyus takes unit x returns nothing
function dxyds takes destructable x returns nothing
function dfus takes unit x returns nothing
function dfxyus takes unit x returns nothing
function cri takes item x, rect y returns boolean
function cru takes unit x, rect y returns boolean
function crd takes destructable x, rect y returns boolean
function cxyi takes item x, real x1, real y1, real x2, real y2 returns boolean
function cxyu takes unit x, real x1, real y1, real x2, real y2 returns boolean
function cxyd takes destructable x, real x1, real y1, real x2, real y2 returns boolean
______________________
END OF FUNCTION LIST*/

/*OPTIONAL SECTION
________________*/
static if LIBRARY_MSGS then
else
function msgall5 takes string s returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,5,s)
set i = i + 1
exitwhen i &gt; 11
endloop
endfunction
function msgall300 takes string s returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,300,s)
set i = i + 1
exitwhen i &gt; 11
endloop
endfunction
endif
/*END OF OPTIONAL SECTION
_______________________*/


function gos takes string order, integer orderid returns nothing
call msgall5(order)
call msgall5(I2S(orderid))
endfunction

//you might want to export the following example
//make another trigger, called GiveOrderStringForUnitType and copy this scope to there
//don&#039;t forget to take off the /* and */ characters to remove it&#039;s status as a comment
/*scope GiveOrderStringForUnitType initializer I

//to debug dummy units or possibly your heroes, change the 
//private constant integer UNITID=YourDummyOrHeroUnitId
globals
private constant integer UNITID=&#039;uloc&#039;
endglobals

private function f takes nothing returns boolean
if GetUnitTypeId(GetOrderedUnit())==UNITID then
call msgall5(&quot;target order:&quot;)
call gos(OrderId2String(GetIssuedOrderId()),GetIssuedOrderId())
return false
else
return false
endif
endfunction
private function g takes nothing returns boolean
if GetUnitTypeId(GetOrderedUnit())==UNITID then
call msgall5(&quot;point order:&quot;)
call gos(OrderId2String(GetIssuedOrderId()),GetIssuedOrderId())
return false
else
return false
endif
endfunction
private function h takes nothing returns boolean
if GetUnitTypeId(GetOrderedUnit())==UNITID then
call msgall5(&quot;order:&quot;)
call gos(OrderId2String(GetIssuedOrderId()),GetIssuedOrderId())
return false
else
return false
endif
endfunction
private function I takes nothing returns nothing
local trigger t = CreateTrigger(  )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( t,Condition( function f))
set t = CreateTrigger(  )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddCondition( t,Condition( function g))
set t = CreateTrigger(  )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t,Condition( function h))
endfunction
endscope*/


//this is where all the display xy stuff is at
//this displays the exact x and y coordinates
//of an item
function dxyi takes item x returns nothing
call msgall300(R2S(GetItemX(x))+&quot;,&quot;+R2S(GetItemY(x)))
endfunction
//of a unit
function dxyu takes unit x returns nothing
call msgall300(R2S(GetUnitX(x))+&quot;,&quot;+R2S(GetUnitY(x)))
endfunction
//of a destructable
function dxyd takes destructable x returns nothing
call msgall300(R2S(GetDestructableX(x))+&quot;,&quot;+R2S(GetDestructableY(x)))
endfunction
//displays the facing angle of a unit
function dfu takes unit x returns nothing
call msgall300(R2S(GetUnitFacing(x)))
endfunction
//displays both the x and y coordinates of a unit and the facing angle
function dfxyu takes unit x returns nothing
call msgall300(R2S(GetUnitX(x))+&quot;,&quot;+R2S(GetUnitY(x))+&quot;,&quot;+R2S(GetUnitFacing(x)))
endfunction
//end of standard verification functions
//the above functions are available for spell debugging also, 5 second messages instead of
//the mass collection style of 300 seconds
function dxyis takes item x returns nothing
call msgall5(R2S(GetItemX(x))+&quot;,&quot;+R2S(GetItemY(x)))
endfunction
function dxyus takes unit x returns nothing
call msgall5(R2S(GetUnitX(x))+&quot;,&quot;+R2S(GetUnitY(x)))
endfunction
function dxyds takes destructable x returns nothing
call msgall5(R2S(GetDestructableX(x))+&quot;,&quot;+R2S(GetDestructableY(x)))
endfunction
function dfus takes unit x returns nothing
call msgall5(R2S(GetUnitFacing(x)))
endfunction
function dfxyus takes unit x returns nothing
call msgall5(R2S(GetUnitX(x))+&quot;,&quot;+R2S(GetUnitY(x))+&quot;,&quot;+R2S(GetUnitFacing(x)))
endfunction

endif

/*Snippet Extension by SanKakU*/

//example:
/*
make a timer run every 1 second of game time.
then make it check
if cru(somespecialunit,somespecialregion) then
...do your thing.

or better yet...
a unit drops an item...(using GT) 
if cri(GetManipulatedItem(),thestash) then
probably pull up some more conditions and make a recipe, or something like that.

it could also be used to remove items that are cluttering up the map if there are lots
of creeps and item drops on your map.
for example...
a unit drops an item...(using GT) 
run a timer for 2 minutes, then check
if cri(GetManipulatedItem(),thebattlefield) then
remove the item.
these are just a few ideas off the top of my head.
*/

//use this function to check if an item is in a box/rect/region
function cxyi takes item x, real x1, real y1, real x2, real y2 returns boolean
if GetItemX(x) &gt; x1 and GetItemX(x) &lt; x2 and GetItemY(x) &gt; y1 and GetItemY(x) &lt; y2 then
return true
endif
return false
endfunction
//this one is same as above, but for a unit
function cxyu takes unit x, real x1, real y1, real x2, real y2 returns boolean
if GetUnitX(x) &gt; x1 and GetUnitX(x) &lt; x2 and GetUnitY(x) &gt; y1 and GetUnitY(x) &lt; y2 then
return true
endif
return false
endfunction
//this one is same as above, but for a destructable
function cxyd takes destructable x, real x1, real y1, real x2, real y2 returns boolean
if GetDestructableX(x) &gt; x1 and GetDestructableX(x) &lt; x2 and GetDestructableY(x) &gt; y1 and GetDestructableY(x) &lt; y2 then
return true
endif
return false
endfunction
//use this function to check if an item is in a box/rect/region
//you only give the item and the rect (region), no xyxy like the above functions
function cri takes item x, rect y returns boolean
if GetItemX(x) &gt; GetRectMinX(y) and GetItemX(x) &lt; GetRectMaxX(y) and GetItemY(x) &gt; GetRectMinY(y) and GetItemY(x) &lt; GetRectMaxY(y) then
return true
endif
return false
endfunction
//use this function to check if a unit is in a box/rect/region
//you only give the item and the rect, no xyxy like the above functions
function cru takes unit x, rect y returns boolean
if GetUnitX(x) &gt; GetRectMinX(y) and GetUnitX(x) &lt; GetRectMaxX(y) and GetUnitY(x) &gt; GetRectMinY(y) and GetUnitY(x) &lt; GetRectMaxY(y) then
return true
endif
return false
endfunction
//use this function to check if a destructable is in a box/rect/region
//you only give the item and the rect, no xyxy like the above functions
function crd takes destructable x, rect y returns boolean
if GetDestructableX(x) &gt; GetRectMinX(y) and GetDestructableX(x) &lt; GetRectMaxX(y) and GetDestructableY(x) &gt; GetRectMinY(y) and GetDestructableY(x) &lt; GetRectMaxY(y) then
return true
endif
return false
endfunction

endlibrary
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top