System Msgs

Status
Not open for further replies.

SanKakU

Member
Reaction score
21
nt
 

Attachments

  • msgs taf version cjass ss.jpg
    msgs taf version cjass ss.jpg
    444.7 KB · Views: 457

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
I figure this will be useful for all my maps.
But a no-no for others' map.
 

Jesus4Lyf

Good Idea™
Reaction score
397
A total lack of explaining what this does makes it unfortunately unhelpful.
Please follow convention - ie. indent code, FunctionNamesLikeThis, etc.

And here's a tip.
JASS:
//! 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'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()),"You got owned by "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+"!",GetOwningPlayer(GetKillingUnit()),"You just dominated "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+"!",true)
call msgtwo35(GetOwningPlayer(GetTriggerUnit()),GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+" just got owned by ",GetOwningPlayer(GetKillingUnit()),GetPlayerName(GetOwningPlayer(GetKillingUnit()))+"!",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't care for submitting two halves in the function call
set i = i + 1
endif
exitwhen i > 11
endloop
endif
endfunction
//! endtextmacro
//! runtextmacro tmdmtp("5")
//! runtextmacro tmdmtp("10")
//! runtextmacro tmdmtp("15")
//! runtextmacro tmdmtp("20")
//! runtextmacro tmdmtp("25")
//! runtextmacro tmdmtp("30")
//! runtextmacro tmdmtp("35")
//! runtextmacro tmdmtp("40")
//! runtextmacro tmdmtp("45")
//! runtextmacro tmdmtp("50")
//! runtextmacro tmdmtp("55")
//! runtextmacro tmdmtp("60")
//! runtextmacro tmdmtp("65")
//! runtextmacro tmdmtp("70")
//! runtextmacro tmdmtp("75")
//! runtextmacro tmdmtp("80")
//! runtextmacro tmdmtp("85")
//! runtextmacro tmdmtp("90")
//! runtextmacro tmdmtp("95")
//! runtextmacro tmdmtp("100")
//! runtextmacro tmdmtp("105")
//! runtextmacro tmdmtp("110")
//! runtextmacro tmdmtp("115")
//! runtextmacro tmdmtp("120")
//! runtextmacro tmdmtp("125")
//! runtextmacro tmdmtp("130")
//! runtextmacro tmdmtp("135")
//! runtextmacro tmdmtp("140")
//! runtextmacro tmdmtp("145")
//! runtextmacro tmdmtp("150")
//! runtextmacro tmdmtp("155")
//! runtextmacro tmdmtp("160")
//! runtextmacro tmdmtp("165")
//! runtextmacro tmdmtp("170")
//! runtextmacro tmdmtp("175")
//! runtextmacro tmdmtp("180")
//! runtextmacro tmdmtp("185")
//! runtextmacro tmdmtp("190")
//! runtextmacro tmdmtp("195")
//! runtextmacro tmdmtp("200")
//! runtextmacro tmdmtp("205")
//! runtextmacro tmdmtp("210")
//! runtextmacro tmdmtp("215")
//! runtextmacro tmdmtp("220")
//! runtextmacro tmdmtp("225")
//! runtextmacro tmdmtp("230")
//! runtextmacro tmdmtp("235")
//! runtextmacro tmdmtp("240")
//! runtextmacro tmdmtp("245")
//! runtextmacro tmdmtp("250")
//! runtextmacro tmdmtp("255")
//! runtextmacro tmdmtp("260")
//! runtextmacro tmdmtp("265")
//! runtextmacro tmdmtp("270")
//! runtextmacro tmdmtp("275")
//! runtextmacro tmdmtp("280")
//! runtextmacro tmdmtp("285")
//! runtextmacro tmdmtp("290")
//! runtextmacro tmdmtp("295")
//! runtextmacro tmdmtp("300")

-->
JASS:
//you would usually use this function for addressing the players both involved in a special event
//like for example, a player'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()),"You got owned by "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+"!",GetOwningPlayer(GetKillingUnit()),"You just dominated "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+"!",true)
call msgtwo35(GetOwningPlayer(GetTriggerUnit()),GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+" just got owned by ",GetOwningPlayer(GetKillingUnit()),GetPlayerName(GetOwningPlayer(GetKillingUnit()))+"!",false)
*/
public function Two takes player p1, string s1, player p2, string s2, boolean two, integer duration returns nothing
local integer i = 0
local integer ip1 = GetPlayerId(p1)
local integer ip2 = GetPlayerId(p2)
if two then
call DisplayTimedTextToPlayer(p1,0,0,duration,s1)
call DisplayTimedTextToPlayer(p2,0,0,duration,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,duration,s1+s2)//if you want, you can just delete either s1 or s2 at this point if you don't care for submitting two halves in the function call
set i = i + 1
endif
exitwhen i > 11
endloop
endif
endfunction

Anyway, this is doable in GUI as far as I can tell, and doesn't warrant a system.. :)

PS.
JASS:
//TDHT=TheDemonHuntTournament, just replace TDHT with your map's main library

Please, avoid asking users to change code inside your system.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Here is the entire library restructured in an orderly manner.
JASS:
//function msgtwo$integer$ takes player p1, string s1, player p2, string s2, boolean two returns nothing
// the above is not useful, use Msg_SinglePlayer twice instead.
library MSGS
    public function Diplomatic takes player p, boolean sendToAllies, string s, integer duration returns nothing
        if IsPlayerAlly(p,GetLocalPlayer())==sendToAllies then
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,duration,s)
        endif
    endfunction

    public function SinglePlayer takes player p, string s, integer duration returns nothing
        call DisplayTimedTextToPlayer(p,0,0,duration,s)
    endfunction

    public function All takes string s, integer duration returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,duration,s)
    endfunction
endlibrary

The only functionality I may not have caught is to do with using the booleans, which don't make sense to me. A boolean flag to make a function do something completely different lacks encapsulation. It should be in two functions for ease of use.

Hope that helps.
 

Jesus4Lyf

Good Idea™
Reaction score
397
your third function doesn't even work.
Fixed. Cheers.
The point was to demonstrate how to get rid of the textmacros, and show that there's alternative ways to do things which you haven't yet considered (such as [LJASS]GetLocalPlayer()[/LJASS]).

>my functions consider multiboard grouping, whereas yours only consider superficial allied status.
Your functions force there to be two teams. :)
 

Trollvottel

never aging title
Reaction score
262
So you covered the point "how to implement and use" it in the documentation. but you didnt mention the sense of this. So i guess there is none?
 

Trollvottel

never aging title
Reaction score
262
it makes sense because it means faster message creation on the cost of ugly function names that break up the whole concept of your map. if your map needs to have an unusually large ammount of messages and dont know copy & paste, you'll want this system.

oh, i understand.
 
Status
Not open for further replies.
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