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: 471

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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top