System Msgs

Status
Not open for further replies.

tooltiperror

Super Moderator
Reaction score
231
If you love {} so much, why don't you use ZINC?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
as for ZINC, i have heard that jasshelper now supports it but i do not know where the instructions are for how to write ZINC.

Here is the ZINC Manual.

by the way, i removed the cJASS entirely from the post, except for that screenshot since i don't know how to remove attachments at thehelper.net
so can you please take it out of the graveyard, since it does not appear to be breaking any submission rules?
and while you're doing that, please fix the name of the thread.

I don't know what you want the name of the thread to be. You can remove the image by going to Edit Post -> Go Advanced -> Manage Attachments.

As far as moving it from the Graveyard, I'm going to hold off until you improve the code. Here's a quick review now:

JASS:
    function GetPlayerTeamMSGS takes integer playerid returns integer//player number for team number.
        if playerid==0 then//my map has player red
            return 1// on team 1.
        elseif playerid==1 then//my map has player blue
            return 1// on team 1.
        elseif playerid==10 then//my map has player dark green
            return 1// on team 1.
        elseif playerid>11 then//neutrals would be on
            return 3// team 3.
        endif//the players 11, and 2-9 are all on 
        return 2// team 2.
        //customize returns as needed, and add/remove elseifs and/or edit elseifs as needed.
    endfunction

This function currently uses if-then checks to determine a player's team? Not only are teams map specific, but you're only using it to compare two players to see if they're on the same team. Why not use one of the built in natives to compare two specific players, instead of taking a player's Id and forcing the map maker to hard code the team? It would also make some of your other functions that rely on it a bit simpler.

Second, while I find comments to be helpful sometimes, your code is over the top. A lot of the comments are not helpful at all:

JASS:
//let's skip fixing up this msggetcolor function for now, need to finish vjass
//the code, then i'll implement my new ideas for colors

This comment says that the function isn't even implemented yet, because the resource isn't finished. We're not going to keep an unfinished resource in the 'awaiting submission' area, so it'll either stay here, or it can be moved into the Members' Projects area.

Comments on the colors that tell which ones are player colors are nice (I'm not sure if they're the exact player colors), but it would be nicer if the name of the variable simply told you that it was a player color, e.g. player_color_red.

JASS:
    function msggetcolor takes integer playerid, string text returns string
//colors text based on player color
        if playerid==0 then
            return gtc(c_red,text)
        elseif playerid==1 then
            return gtc(c_brightblue,text)
        elseif playerid==2 then
            return gtc(c_aqua,text)
        elseif playerid==3 then
            return gtc(c_purple,text)
        elseif playerid==4 then
            return gtc(c_yellow,text)
        elseif playerid==5 then
            return gtc(c_orange,text)
        else
            return gtc(c_white,text)
        endif//of course customize as you wish, you can add
        return text
    endfunction

This could be made much simpler by making an array of colors, and then [ljass]return gtc(color[playerid], text)[/ljass], if you didn't make this synchronize with player's colors. I think you ought to know that it's possible to track down a player's color (since it is changeable in the game lobby). My P2HS function in the stringPlayer library does this.

JASS:
function msgall takes real duration, string text returns nothing//benefits?
    local integer x=low//ignore the extra parameters in DTTTP
        loop//manipulate duration easily, as opposed to BJDM
            set x=x+1
        exitwhen x>high
            call DisplayTimedTextToPlayer(Player(x),0,0,duration,text)
        endloop
    endfunction

This function can be replaced with this: [ljass]call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, duration, text)[/ljass], which I don't think is worthy to put inside a system.
 

Sim

Forum Administrator
Staff member
Reaction score
534
We need a quick description of what your system does, either at the top of the thread or the header section of the script.
 

Vestras

Retired
Reaction score
248
You seem to be really lazy. When coding, don't be. It pays off to type out function/variable names.
Also, I think the whole cryptic-code thing you're doing with all the strange ways of indentation, newlines, etc. (An ugly C-style, as some may call it), is just to hide that you are not very good with coding, nor good with implementing your systems and/or libraries.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Sim, I have added that at the top of the original post.

Darthfett, i haven't been using GetLocalPlayer() because it seems to cause desyncs.
as for the actual recommendation to not use msgall, that's your preference to type a function call that's four times as long as mine. and the parameters are bothersome, as well.

the rest of your post is nonsense. a coder that wanted to do those things wouldn't need this system.
it is unrelated and off-topic.

furthermore, the code i left in there is still valid and useable. it's not "unfinished". it simply wasn't expanded appropriately. and ya, obviously the part about needing to finish vjass was obsolete.

does that look like cjass to you? because it looks like vjass to me. just, please. don't waste time posting such garbage reviews. you'll never finish your map projects wasting your time like that.

if you wanted to review it that badly, which is understandable, you could have posted something like i will review this 'when i have the time' or 'soon' or whatever phrase you wanted to use. then you could do some research. i'm not so impatient that i can't wait.

It will stay Graveyarded.

If you can't take criticism, we can't take your resource.
 

SanKakU

Member
Reaction score
21
that's rather foolish.

you don't accept even my vJASS? i will take it back. it's officially useless in the graveyard.
 

SanKakU

Member
Reaction score
21
You seem to be really lazy. When coding, don't be. It pays off to type out function/variable names.
Also, I think the whole cryptic-code thing you're doing with all the strange ways of indentation, newlines, etc. (An ugly C-style, as some may call it), is just to hide that you are not very good with coding, nor good with implementing your systems and/or libraries.

i never said the coder wasn't allowed to rename functions and variables. it's an easy thing to do and takes practically no effort. another thing that takes practically no effort is to actually confirm that the system is useful and is being used.
 

tooltiperror

Super Moderator
Reaction score
231
It'd almost be nice to have something like a SpellStruct for a message. Interface would need work, but:
JASS:
library StringExample initializer onInit requires MessageStruct
    struct StringExample
        // Fired after the message is displayed.
        // Could be used to do something like respond to another message.
        method onDisplay takes nothing returns nothing
            if (this.string=="Hello, world!") then
                thistype.Display("Hello, individual!") // I smell recursion!
            endif
        endmethod
        // If this method returns true, the string will be displayed, if false
        // it will not display.  This can be used to "catch" bad strings for example.
        method preDisplay takes nothing returns boolean
            if (this.string=="Hello, no one!") then
                return false
            endif
            return true
        endmethod
        implement MessageStruct // add it in
    endstruct    
    private function onInit takes nothing returns nothing
        StringExample.Display("Hello, world!")
    endfunction
endlibrary
 

Vestras

Retired
Reaction score
248
i never said the coder wasn't allowed to rename functions and variables. it's an easy thing to do and takes practically no effort. another thing that takes practically no effort is to actually confirm that the system is useful and is being used.

I was referring to you, not the non-existant users of this [del]system[/del]piece of crap.
 

SanKakU

Member
Reaction score
21
It'd almost be nice to have something like a SpellStruct for a message. Interface would need work, but:
JASS:
library StringExample initializer onInit requires MessageStruct
    struct StringExample
        // Fired after the message is displayed.
        // Could be used to do something like respond to another message.
        method onDisplay takes nothing returns nothing
            if (this.string=="Hello, world!") then
                thistype.Display("Hello, individual!") // I smell recursion!
            endif
        endmethod
        // If this method returns true, the string will be displayed, if false
        // it will not display.  This can be used to "catch" bad strings for example.
        method preDisplay takes nothing returns boolean
            if (this.string=="Hello, no one!") then
                return false
            endif
            return true
        endmethod
        implement MessageStruct // add it in
    endstruct    
    private function onInit takes nothing returns nothing
        StringExample.Display("Hello, world!")
    endfunction
endlibrary

well, at least someone is trying to be fun and creative.(unless you're just testing me with pretense, which would be understandable considering the situation)
btw this is completely off-topic but it is an interesting idea.

i understand what you're thinking of by your comments but i don't know how to use structs and methods so i could only guess at how to make a struct that you would "implement". i've never used that sort of code before. but, like i said, it looks interesting. of course it's still off-topic. but i guess what i just said is irrelevant now.

anyway i haven't examined it in my detail, but my guess is darthfett already has a system for what you would be trying to do...although of course i don't have all the details perhaps of your intentions that's my guess at the moment.

the system is called stringfilter.
i actually dislike the name, if i understand the system correctly, it should be called stringreplace.
 

tooltiperror

Super Moderator
Reaction score
231
I have to go, but take this.

System
JASS:
//      __  __                          ___ _               _   
//     |  \/  |___ ______ __ _ __ _ ___/ __| |_ _ _ _  _ __| |_ 
//     | |\/| / -_|_-<_-</ _` / _` / -_)__ \  _| '_| || / _|  _|
//     |_|  |_\___/__/__/\__,_\__, \___|___/\__|_|  \_,_\__|\__|              tooltiperror
//                            |___/                
//
//  What is MessageStruct?
//    - MessageStruct is an expiremental snippet.
//    - It provides an interface for dealing with updates and players, and
//      doing it all in a clean interface.
//
//  MessageStructs
//    - To make a struct a MessageStruct, put "implement MessageStruct" at 
//      the very bottom of your struct.
//    - A MessageStruct must extend array
//    - You have several (optional) methods to chose from:
//        - method onDisplay takes nothing returns nothing
//            - Fires after displaying a message.
//        - method preDisplay takes nothing returns boolean
//            - Fires right before displaying a message.
//            - If false, does not display the string.
//        - method playerFilter takes player p returns boolean
//            - Same as preDisplay, but you can use the player p
//              argument.
//            - If false, player p does not see the message.
//
//  Variables
//      - this.string
//     
//      - this.duration
//
//~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~
library MessageStruct requires Alloc
    globals
        private integer index=0
        private player Who
    endglobals
    // Make a delegate for defaults
    private struct Default extends array
        method onDisplay takes nothing returns nothing
        endmethod
        method preDisplay takes nothing returns boolean
            return true
        endmethod
        method playerFilter takes player who returns boolean
            return true
        endmethod
    endstruct
    globals
        private Default DEFAULT = Default(0)
    endglobals
    
    // The MessageStruct module
    module MessageStruct
        delegate Default DEFAULT
        readonly string string
        readonly real duration
        static real DefaultDuration
        
        static method Display takes string str returns nothing
            local thistype this=thistype.allocate()
            set this.string=str
            set this.duration=thistype.DefaultDuration
            if (this.preDisplay()) then
                loop
                    set Who=Player(index)
                    if (this.playerFilter(Who)) then
                        call DisplayTimedTextToPlayer(Who,0,0,60,this.string)
                    endif
                    set index=index+1
                    exitwhen index==15
                endloop
                call this.onDisplay()
            endif
        endmethod
        private static method onInit takes nothing returns nothing
            set thistype.DefaultDuration=60.00
        endmethod
        implement Alloc
    endmodule
endlibrary


Example
JASS:
library Test requires MessageStruct
    struct MessageStructTest extends array
        static boolean array Secret[3] // let's assume there's only 3 players
        
        method onDisplay takes nothing returns nothing
            if (not thistype.Secret[GetPlayerId(GetLocalPlayer())]) then
                call BJDebugMsg("You saw the secret message!")
            else
                call BJDebugMsg("Normal hello world!")
            endif
        endmethod
        method preDisplay takes nothing returns boolean
            return true
        endmethod
        method playerFilter takes player p returns boolean
            if (p==Player(1)) then
                return true
            endif
            set thistype.Secret[GetPlayerId(p)]=true
            return false
        endmethod
        private static method onInit takes nothing returns nothing
            call thistype.Display("Test")
        endmethod
        implement MessageStruct
    endstruct
endlibrary
 

Romek

Super Moderator
Reaction score
963
I'm completely baffled as to why you decided to upload a screenshot of your code to the first post. Now not only is it cJass, but anybody who actually wants to use your code can no longer copy it into their map. :rolleyes:

romek if you even tried coding in cjass it's not like you're able to make a lot of errors and it be easily forgiven. even if you squish the code you still have to deal with being very precise and handle your ; keys properly. i was just struggling with the cjass loops since i'm still a little newb with them and realized i had missed a couple of ;.
I've used cJass before. In fact, I was very interested in it back in its early development stages (I'm sure I have a few comments on the first page or so of the cJass website). I then realised it wasn't anywhere near as good as it was being made out to be, and it just encouraged bad coding practices with no real benefits whatsoever. I wouldn't have made a decision such as the one to disallow cJass in the T&R forum without knowing what cJass was in the first place. As for semicolons? Welcome to real programming. I often have to make a concious effort not to type semicolons because I'm too used to it. :p

my stand is that thehelper's stance against not indenting code is like saying it's messy to stack cards in a deck. it's like you're saying further that i'm not allowed to stack the cards in my hand, or if i show my hand to you, a fellow card player, i must first lay the cards on the table and unstack them, so that each card is not touching any other card, all in a neat line. i think you can actually see the cards in my hand much quicker if you just glance over my shoulder. that's my point, here...you're posting trashtalk about cjass and lack of indentation in vjass coding and i don't like that one bit. but this is off-topic, and i came back to mention that i finished fixing up the msgally function, including adding the encapsulated functions that j4l requested. i'm going to continue to make some more updates though, meaningi i'm going to optimize control over the coloring of the messages. but before i get into that i'll convert my code into vjass. please stand by.
I think a better comparison would be to an encyclopaedia without a contents page or titles/headers. You have to read through every page regardless of what you're looking for, as there's no system that allows you to systematically skip through irrelevant parts of the book.

Also, in the future, don't edit every post in the thread when you decide to quit. It prevents people from looking back to the thread for reference purposes. I'll close this thread now for that reason (it's turned into quite a mess anyway). If you wish to discuss anything, feel free to PM me.
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top