tooltiperror
Super Moderator
- Reaction score
- 231
If you love {} so much, why don't you use ZINC?
Here is the ZINC Manual.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.
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.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.
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.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 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.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 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 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 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.
It will stay Graveyarded.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's useless no matter if it's in the graveyard or not.that's rather foolish.
you don't accept even my vJASS? i will take it back. it's officially useless in the graveyard.
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.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.
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
I was referring to you, not the non-existant users of this [del]system[/del]piece of crap.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.
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)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
// __ __ ___ _ _
// | \/ |___ ______ __ _ __ _ ___/ __| |_ _ _ _ _ __| |_
// | |\/| / -_|_-<_-</ _` / _` / -_)__ \ _| '_| || / _| _|
// |_| |_\___/__/__/\__,_\__, \___|___/\__|_| \_,_\__|\__| 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
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
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.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 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.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.