Battlezone Universe

Battlezone Universe => Battlezone 2 => Maps and Modding => Topic started by: Red Spot on May 14, 2009, 01:00:55 PM

Title: Shell options
Post by: Red Spot on May 14, 2009, 01:00:55 PM
Have set up an option in the shell to switch teamcolors, beter said, give the host the option to tweak the teamcolors from within the shell.
(http://members.ziggo.nl/red_spot/Tcolors.jpg)

This works nicelly, however now you need to press the "Custom" button before the values at the bottom are read by the dll.
I can also set it up so the buttons do no longer highlight the selected color but update the RGB values at the bottom, so I can just let the dll read the RGB values.

However I would really like it to do both, so say when you select the "light blue" color button it stays highlighted but also updates the below values to 0.0.255 (or whatever values are set).

The difference between the 2 settings is caused by the "Radio" flag in the shell file, is there some way to cause them both to work?


eg:
this highlights the button, but ignores the 'button pressed event'
CreateControl("NoColorsA", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(50, 20); //
Size(60, 9); //
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "RADIO", "OUTLINE");
Cursor("Highlight");
Font("TINY");
Text("No Color");
UseVar("network.session.ivar35");
Value(0);
NotifyParent("Button::Press", "bNoColorsA");
}

OnEvent("bNoColorsA")
{
Cmd("network.session.ivar37 0");
Cmd("network.session.ivar38 0");
Cmd("network.session.ivar39 0");
}


This uses the 'button pressed event' but always highlights the button
CreateControl("NoColorsA", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(50, 20); //
Size(60, 9); //
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "OUTLINE"); // ("ROLLOVER", "RADIO", "OUTLINE");
Cursor("Highlight");
Font("TINY");
Text("No Color");
UseVar("network.session.ivar35");
Value(0);
NotifyParent("Button::Press", "bNoColorsA");
}

OnEvent("bNoColorsA")
{
Cmd("network.session.ivar37 0");
Cmd("network.session.ivar38 0");
Cmd("network.session.ivar39 0");
}


Thanks :)
Title: Re: Shell options
Post by: mrtwosheds on May 14, 2009, 01:13:38 PM
Well done. hmm shouldn't there be 2 lots of numeric entry box's, one for each team?
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 01:19:52 PM
There will be, I was testing how it all worked.
Title: Re: Shell options
Post by: AHadley on May 14, 2009, 01:28:11 PM
Does this work with all maps, or just yours?
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 01:36:37 PM
Quote from: AHadley on May 14, 2009, 01:28:11 PM
Does this work with all maps, or just yours?

It is set by the dll, so it is map-specific. But in the maps inf file you can set which teamcolor should be used when selecting the map, even custom colors can be specified, or both.

ivar35 = 0..16 // Team A pre-set color.
ivar36 = 0..16 // Team B pre-set color.

ivar37 = 0..255 // Team A custom color "Red" value.
ivar38 = 0..255 // Team A custom color "Green" value.
ivar39 = 0..255 // Team A custom color "Blue" value.

ivar40 = 0..255 // Team B custom color "Red" value.
ivar41 = 0..255 // Team B custom color "Green" value.
ivar42 = 0..255 // Team B custom color "Blue" value.
Title: Re: Shell options
Post by: General BlackDragon on May 14, 2009, 03:15:40 PM
Hi. You're local shell expert here.  :-D

To switch between radio buttons and normal press buttons, you must change 2 things:

1: If radio is in the style, you have to change the notify parent to this: NotifyParent("Button::Select", "NAMEHERE");

When removing Radio, or not using Radio in the style, you must change it back to Button::Press

Your welcome :)
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 03:36:41 PM
Quote from: General BlackDragon on May 14, 2009, 03:15:40 PM
Hi. You're local shell expert here.  :-D

To switch between radio buttons and normal press buttons, you must change 2 things:

1: If radio is in the style, you have to change the notify parent to this: NotifyParent("Button::Select", "NAMEHERE");

When removing Radio, or not using Radio in the style, you must change it back to Button::Press

Your welcome :)

Many thanks :)
Works like a charm
CreateControl("NoColorsA", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(50, 20); //
Size(60, 9); //
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "RADIO", "OUTLINE");
Cursor("Highlight");
Font("TINY");
Text("No Color");
UseVar("network.session.ivar35");
Value(0);
NotifyParent("Button::Select", "bNoColorsA");
}

OnEvent("bNoColorsA")
{
Cmd("network.session.ivar37 0");
Cmd("network.session.ivar38 0");
Cmd("network.session.ivar39 0");
}
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 03:47:05 PM
Do you by any chance also know if I can make the "Custom" button the selected button if you edit one of the numeric boxes at the bottom ?

This doesnt work, nor does the 'button pressed' event:
CreateControl("ColorA1", "EDIT")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Position(40, 220);
Size(22, 9);
BorderSize(3);
BevelSize(3);
JustifyText("center");
Font("TINY");
Style("ROLLOVER", "OUTLINE");
Cursor("Highlight");
UseVar("network.session.ivar37");
SetIntegerRange("network.session.ivar37", 0, 255);
NotifyParent("Button::Select", "bCustomA");
}

OnEvent("bCustomA")
{
Cmd("network.session.ivar35 16");
}
Title: Re: Shell options
Post by: General BlackDragon on May 14, 2009, 04:00:11 PM
um...not really, maybe. you might could just leave a note for the user in the bottom saying they have to press it if using the fields above.
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 04:06:56 PM
Quote from: General BlackDragon on May 14, 2009, 04:00:11 PM
um...not really, maybe. you might could just leave a note for the user in the bottom saying they have to press it if using the fields above.

Its not really a big problem, the color-buttons now update the RGB-values at the bottom. So I now can have the dll check if the pre-set color ivars are on 0 or 1 (no teamcolors, or use localprefs), the rest can than be done by letting the dll use the other ivars. But it would have been nice if the button jumps to "Custom" if you do edit a color .. just shows a bit clearer which color you are actually using.

edit: This works if you press enter after typing a value, but as when you tab out of the box or select the next box and it wont trigger its not really that usefull ..
"Edit::Enter"
Title: Re: Shell options
Post by: TheJamsh on May 14, 2009, 05:28:23 PM
This is going to be a problem for people with modified localprefs teamcolors.
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 05:46:05 PM
Why so ?
Title: Re: Shell options
Post by: Nielk1 on May 14, 2009, 05:54:37 PM
How are you accounting for the gamprefs system? You better note dare phase it out? There are DLL functions to get that data so default should cause the team color system to be used. I can also see this causing monstrous issues if players choose to override team colors. How have you coded to ensure that the client side override and server side gameprefs style settings work?
Title: Re: Shell options
Post by: General BlackDragon on May 14, 2009, 06:09:48 PM
how are babies made?  :-D :lol:

Sorry, random thought.

Yeah, the client side gameprefs may be overridden but not overwritten.
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 07:27:44 PM
This worked in 1.2, and so far works in 1.3 as well ... Thats all I'm doing.
if (m_HumanTeamColor == 0)
{
ClearTeamColor(m_StratTeam);
}
else if (m_HumanTeamColor > 1)
{
SetTeamColor(m_StratTeam, m_HumanTColorRed, m_HumanTColorGreen, m_HumanTColorBlue);
}
if (m_CPUTeamColor == 0)
{
ClearTeamColor(m_CPUTeamNumber);
}
else if (m_CPUTeamColor > 1)
{
SetTeamColor(m_CPUTeamNumber, m_CPUTColorRed, m_CPUTColorGreen, m_CPUTColorBlue);
}


From map "MPI: Instant Test" :):
(http://members.ziggo.nl/red_spot/MPITest.jpg)
Title: Re: Shell options
Post by: Nielk1 on May 14, 2009, 08:09:03 PM
OK, you REALLY need to look a the new functions to get the other settings, or players will be mighty angry with you they can just click host and have it instantly have their pre-set custom colors.
Title: Re: Shell options
Post by: Red Spot on May 14, 2009, 08:38:02 PM
Who says I havent ? ;)

Anyway, why would someone be upset cause the person who is hosting a game selects a certain setting? Its like saying I shouldnt allow a custem recy cause someone might get upset when you select it. Remember this is an option, not a mandatory setting.

Besides that, look below:
http://members.ziggo.nl/red_spot/Recy%201.jpg
http://members.ziggo.nl/red_spot/Recy%202.jpg
http://members.ziggo.nl/red_spot/Recy%203.jpg
http://members.ziggo.nl/red_spot/Recy%204.jpg
Title: Re: Shell options
Post by: Nielk1 on May 14, 2009, 10:42:50 PM
Please read my posts!
Read read read!

I said the PLAYER would be upset that their long thought out custom colors are not READ IN as they are supposed to be, or they are NOT GETTING THE HOST'S CUSTOM COLORS as they wanted, but instead only have the option of what the host (or perhaps themselves) set in shell.

You are going about this all the wrong way.
Very very very very wrong.

game.teamcolors is NOT the color selector. It is what simply tells the game if no colors, team colors, or FFA colors are used. Gameprefs is what sets the colors, and if you prevent the reading of gameprefs you are making some player who spent the time to make their custom colors so they do not have to enter theme very time very angry.

You MUST, and this is critical MUST, program in reading of the current chosen settings in relation to the new team color system or otherwise ensure the feature still works. You cannot simply ignore it and treat this like pb4a.

Unless of course you did take care of that, which I doubt from your responses, but you may think you did.


EDIT:
You should use the following functions:
DLLEXPORT void DLLAPI SetTeamColor(int team, int red, int green, int blue);
DLLEXPORT void DLLAPI ClearTeamColor(int team);

// More teamcolors functions.
enum TEAMCOLOR_TYPE
{
TEAMCOLOR_TYPE_DEFAULT, // Defaults
TEAMCOLOR_TYPE_GAMEPREFS, // What's set in gameprefs
TEAMCOLOR_TYPE_SERVER, // What the server sent us.
};

// Set functions. Probably easier to use these functions when setting
// a bunch. Does nothing if type is invalid
DLLEXPORT void DLLAPI SetFFATeamColors(TEAMCOLOR_TYPE type);
DLLEXPORT void DLLAPI SetTeamStratColors(TEAMCOLOR_TYPE type);

// Get functions. These will set r/g/b to 0 if a setting for type or
// team is invalid. For GetTeamStratColor, the team parameter must be
// 0 (first teamgroup) or 1 (second teamgroup)
DLLEXPORT void DLLAPI GetFFATeamColor(TEAMCOLOR_TYPE type, int team, int& red, int& green, int& blue);
DLLEXPORT void DLLAPI GetTeamStratColor(TEAMCOLOR_TYPE type, int team, int& red, int& green, int& blue);

// Swaps the current teamgroup colors, e.g. swap colors of teams 1..5
// <-> 6..10.  Note - this can be called, even if FFA colors are
// set. You may not like the results if you do that.
DLLEXPORT void DLLAPI SwapTeamStratColors(void);

// Returns whether the last set of team colors set were FFA (returns
// true) or Team Strat (returns false). Calling these functions will
// change its return value:
//
// TeamplayTeamColors(), SetTeamStratColors() - will return false
// DefaultTeamColors(), SetFFATeamColors() - will return true
DLLEXPORT bool DLLAPI GetTeamColorsAreFFA(void);

// After ffa or team colors are set up -- i.e. one of the 4 functions
// listed above GetTeamColorsAreFFA() is called -- this will call
// SetFFATeamColors() or SetTeamStratColors(). Just a convenience
// function.
DLLEXPORT void DLLAPI SetTeamColors(TEAMCOLOR_TYPE type);


EDIT:

Do me a favor red. With how you have it now, test the 3 chatline commands that control colors, if they still work right it might be no worry. I would suggest a button for clients that auto enters the 3 options and for server that auto enters the 2 (not server).
Title: Re: Shell options
Post by: Red Spot on May 15, 2009, 09:15:35 AM
Quote from: Nielk1 on May 14, 2009, 10:42:50 PM
Please read my posts!
Read read read!

I'm guessing you need to read mine, as I said before, it is an "option" .. do nothing and the colors will not be changed, don't use it if you get angry cause it overrides your localpref colors....

You also do not need to post code from scriptutilities.h as I've seen it, where do you think I get commands from ..

QuoteUnless of course you did take care of that, which I doubt from your responses, but you may think you did.

Did you look at the pictures I posted above? The last one is the color from localprefs, so even if a color is set you can still go back to your own preferences.
Title: Re: Shell options
Post by: Nielk1 on May 15, 2009, 03:38:13 PM
The Last one is TEAM, not colors from gameprefs. Take a look at them, they are the stock TEAM colors, unless you CHOSE to set your custom colors the same and did not realize yourself.

And stop smiting me every time I try to warn you about things.

I read your GOD DAMN post, and you DID NOT READ MINE.

I described in my post what in yours was incorrect about your reading/understanding of mine. I wrote in mine what you did show and what you apparently thought you showed, but since you are to dense to see it, let me put it in a more direct format:

YOU DID NOT READ MINE:
I talked about how players would be angry if this overrode their custom settings.
You said I was saying some irrelevant thing about a client angry with server settings, when I was talking about an angry server AND client about the inability to use what they want. Your situation did not match the one I gave. The images you gave would have dispersed any concern on my side, if they showed ANYTHING. As for smiting me, I gave you god damn code, I went out of my way to try to help you, to indicate where you may ahve a problem, don't be an ungrateful ass.

I READ YOUR POST:
Your pictures indeed DO NOT show what you think they do. They show your custom from DLL, then none, then STOCK FFA, then STOCK TEAM. Note, they showed STOCK STOCK STOCK colors, not custom.


So, either dispel my concerns or apologize for attacking me when all I tried to do was both warn you, clarify what I said, and give you a nudge in the correct direction to resolve the issue. This simplest way to dispel concerns would be to show your team color function or some such from your DLL, but instead you insist on misreading my posts, then accusing me of doing the same when I give what you said and what I see said, but you never touch on those, just claim I am wrong again with no support.

NOTE: I consider a smite in return for attempting to help you an attack.
Title: Re: Shell options
Post by: Red Spot on May 15, 2009, 03:52:21 PM
I suggest you check what you're saying before you start your flaming .. as "game.teamcolors 2" uses the settings from localprefs .. I made sure I checked that ...

What do you think I do, just write some code and blindly accept it works or do you think I actually test these things ? (well, stupid question actually ...)

If you cant reply in a normal way and make sure what you suggest is actually correct than please stop posting in my topics, thanks.
Title: Re: Shell options
Post by: Nielk1 on May 15, 2009, 04:20:51 PM
Quote from: Red Spot on May 15, 2009, 03:52:21 PM
I suggest you check what you're saying before you start your flaming .. as "game.teamcolors 2" uses the settings from localprefs .. I made sure I checked that ...
Your images showed STOCK COLORS. Show me gameprefs colors and I have no more concern. Do you purposely write responses that do not answer questions and act like they do? How do I know your DLL does not effect the TEAM and FFA colors (which it can)? How do I know your code doesn't kill the gameprefs customs and make only stock colors accessible? Only you have your code. I still have not flamed, though I have been quicker to anger since this is the third time you disregard what I say and answer with non answers. You... You.. Politician :-P

Quote from: Red Spot on May 15, 2009, 03:52:21 PM
What do you think I do, just write some code and blindly accept it works or do you think I actually test these things ? (well, stupid question actually ...)
Yes, I do. Unless you show me something to the contrary like images that show colors that are actually custom, you have failed to show me anything to shows you have forethought this issue.

Quote from: Red Spot on May 15, 2009, 03:52:21 PM
If you cant reply in a normal way and make sure what you suggest is actually correct than please stop posting in my topics, thanks.
I did reply the normal way, then you ignored what I said or changed it in some way to suite your ability to dismiss it. So I tried to correct your misreading of my post, though stronger than I normally would as this is the third topic you would do so, and you apparently failed to read beyond 4 choice lines your used to again dismiss what I said without an actual answer. BTW, selective reading and interpreting means you did not read my whole post, or at least, failed to process it all.

I end up considering things you ignore to be true since you must have ignored them for some reason.


EDIT:
Quote from: Red Spot on May 15, 2009, 09:15:35 AM
Did you look at the pictures I posted above? The last one is the color from localprefs, so even if a color is set you can still go back to your own preferences.

My point is THEY DO NOT SHOW IT IS WORKING!

I asked someone to come look at this thread and tell me who's wrong. I know I angered quicker than normal but after a sum total of 10 posts of yours like this in other topics and about 7 undeserved smites, what do you expect of me when you start twisting words (includes word omission) again?
Title: Re: Shell options
Post by: Red Devil on May 15, 2009, 05:21:36 PM
Okay, enough "Code Rage".  Shouting only makes people deaf to what you are saying.
Title: Re: Shell options
Post by: Nielk1 on May 15, 2009, 05:44:30 PM
After saying the same thing 4 times I must agree. Screw it, do what you want... :|

If you have a question ask it but if you make any possible errors and don't see them I won't say anything. Till its released. Then you will have to patch.
Title: Re: Shell options
Post by: Red Spot on May 15, 2009, 08:15:56 PM
GBD,

Incase you'd like to know, I got it all to work as I wanted in the shell, updated the picture in the first post.
The boxes at the bottom only show the RGB values, the (transparent)"Custom" button launches a new window and a (blank)button hidden behind it makes sure the "Custom" button lights up when selected :)

edit: The dummy button is cause if I do it without you can only press the "Custom" button once. Then have to press an other button to be able to re-use the "Custom" button. With the dummy button it does light up and you can re-use it.

CreateControl("CustomADummy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(50, 200); //
Size(60, 9); //
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "RADIO", "OUTLINE");
Cursor("Highlight");
Font("TINY");
Text("");
UseVar("network.session.ivar35");
Value(16);
}

CreateControl("CustomA", "BUTTON")
{
//ColorGroup("TRANSPARENT");
Geometry("LEFT", "TOP");
Pos(50, 200); //
Size(60, 9); //
BorderSize(3);
BevelSize(3);
Style("TRANSPARENT", "ROLLOVER", "OUTLINE"); //Style("ROLLOVER", "RADIO", "OUTLINE");
Cursor("Highlight");
Font("TINY");
Text("Custom");
NotifyParent("Button::Press", "bCustomA");
}



OnEvent("bCustomA")
{
Cmd("network.session.ivar35 16");
Exec("bzshell_multi_rsvcolorsA.cfg");
FadeIn("|RSVColorsA");
}



CreateControl("ColorA1", "STATIC")
{
ColorGroup("LISTBOX");
Geometry("LEFT", "TOP");
Position(40, 220);
Size(22, 9);
BorderSize(3);
BevelSize(3);
Style("BLACK");
Font("TINY");
JustifyText("center");
Text("%d");
UseVar("network.session.ivar37");
}

CreateControl("ColorA2", "STATIC")
{
ColorGroup("LISTBOX");
Geometry("LEFT", "TOP");
Position(69, 220);
Size(22, 9);
BorderSize(3);
BevelSize(3);
Style("BLACK");
Font("TINY");
JustifyText("center");
Text("%d");
UseVar("network.session.ivar38");
}

CreateControl("ColorA3", "STATIC")
{
ColorGroup("LISTBOX");
Geometry("LEFT", "TOP");
Position(98, 220);
Size(22, 9);
BorderSize(3);
BevelSize(3);
Style("BLACK");
Font("TINY");
JustifyText("center");
Text("%d");
UseVar("network.session.ivar39");
}
Title: Re: Shell options
Post by: xSSx Grizzly on May 15, 2009, 09:08:31 PM
I like the look of it mate, will save me going through all the cr*p again  :-D :wink:
Title: Re: Shell options
Post by: Sonic on May 16, 2009, 06:06:14 AM
OK look, I don't like finding someone hitting the ABUSE BUTTON because they can't take an argument. No one here is really breaking any forum rules. Yes, Nielk is a bit heated up at the moment but I understand why. Red Spot, Nielk is trying to tell you how TA5 works; players can specify their custom team colors in the gameprefs.ini file. Your option game "game.teamcolors 2" is used by the game system to determine which color scheme to use (aka, Team Strat, FFA, etc). You appear to be using a number that is already assigned and thus can cause major issues with the system already in place.

I have a custom DLL I write with friends and I have to watch the toes I step on. It worked fine in pb3 but when I ported it to TA5, some of the ivar/svar's I was using were now used by stock. In fact, I was reading an option from the DM "Gravity" setting; so I modify my ivars and adjusted my shell accordingly. Please READ what Nielk is saying, if you don't fully understand what he is saying, ask someone to translate for you or ask Nielk to slow down. He isn't a bad guy nor is he out to get you.

Also, consider this a WARNING. Anyone who pushes 'report to moderator' (you know who you are) when no forum rules are clearly being violated will get a Temp Ban from me. I do NOT enjoy finding these things in my mail box only to find the issue being an argument. If you feel you are being flamed, PM me or another moderator/admin and we will look at it when we have a chance. Do NOT abuse the abuse button.