Page 1 of 2

Still showing to have the enemies flag

Posted: Mon Oct 15, 2018 12:25 am
by KILROY
Version 1.30 using presto pack. Was on showing one of my nephew's the game and after grabbing the enemy flag, bringing it back to my base for a cap, presto still showed that I had the enemies flag when it had already returned to the enemy base.

Re: Still showing to have the enemies flag

Posted: Tue Oct 16, 2018 4:52 pm
by perrinoia
That script works by parsing the chat messages as they are sent from the server to the client.
The script compares the message received to a series of known messages, then alters the HUD accordingly.

If you play a mod whose game messages are unknown to the script, it will not react to the messages.
If a player, team, or objective name contains illegal characters, the script will not react properly.

Re: Still showing to have the enemies flag

Posted: Tue Oct 16, 2018 8:27 pm
by perrinoia
I've been observing for awhile and just noticed that the game messages about flags announce what armor the flag carrier is wearing. This is probably the reason the flag hud in your config doesn't recognize the message anymore.

Re: Still showing to have the enemies flag

Posted: Wed Oct 17, 2018 4:02 am
by KILROY
Hmm...strange, never did this before in the past. Then again, it was a map that usually I didn't play. Don't remember the name of it, but it has two bases that looked like the mid structure in Stonehenge as the bases, and in the middle of the map were 3 towers. Middle tower was setup as an objective, scene was desert.

EDIT: Now, this did happen a long time ago, and there was something done that fixed it, but it's been so long, I don't remember the fix.

Re: Still showing to have the enemies flag

Posted: Wed Oct 17, 2018 4:50 pm
by perrinoia
Yeah, i could fix it if i had a copy of the script. Can you isolate the flag hud script and email it to me?

Re: Still showing to have the enemies flag

Posted: Thu Oct 18, 2018 4:14 am
by KILROY
Well...I don't have your email, but I am using Presto 1.5 from March 1999. Not sure if that's the latest version that came out for it, but I've done no changes to it. It doesn't exactly relay on any of the CS listing's something that deals with the flag, but in the DynHud CS it does, and in the Writer folder the Event CS file show's a bunch about the flag. I'm not sure if it's what your looking for since I don't know anything about scripting.

Re: Still showing to have the enemies flag

Posted: Thu Oct 18, 2018 4:47 am
by perrinoia
Search for "onClientMessage".

function onClientMessage parses the messages received by the client from the server. It's the function I modified to make a custom auto waypoint script for S']['U to make him a better Uber driver. It's also likely the function your config uses to listen for flag activity.

Also, you could PM me instead of emailing me, or just post it here. Whatever works.

I thought I had received emails from you before, but I realize now that they were emails from the forum notifying me of private messages from you.

Re: Still showing to have the enemies flag

Posted: Thu Oct 18, 2018 5:28 am
by KILROY
I couldn't find anything relaying that, but did find this in the DynHud CS file. This isn't the whole script, before this was scripts for Kill Tracking and after this was a counter for mines, grenades, repair kits, and a kill counter.

%teamFlag = Team::GetFlagLocation(Team::Friendly());
%enemyFlag = Team::GetFlagLocation(Team::Enemy());

if (%teamFlag == $Trak::locationHome)
HUD::AddTextLine(hudDyn, "<f1>Your flag: home");
else if (%teamFlag == $Trak::locationField)
HUD::AddTextLine(hudDyn, "<f1>Your flag: dropped");
else if (%teamFlag == "")
HUD::AddTextLine(hudDyn, "<f1>Your flag: home?");
else HUD::AddTextLine(hudDyn, "<f1>Kill:<f2> " @ %teamFlag);

if (%enemyFlag == $Trak::locationHome)
HUD::AddTextLine(hudDyn, "<f1>Enemy's: home");
else if (%enemyFlag == $Trak::locationField)
HUD::AddTextLine(hudDyn, "<f1>Enemy's: dropped");
else if (%enemyFlag == "")
HUD::AddTextLine(hudDyn, "<f1>Enemy's: home?");
else {
if (%enemyFlag == client::getname(getManagerId()))
HUD::AddTextLine(hudDyn, "<f2>You have theirs!");
else HUD::AddTextLine(hudDyn, "<f1>Help:<f2> " @ %enemyFlag);
}

if (%teamFlag == $Trak::locationHome || %teamFlag == "")
HUD::AddText(hudDyn, "<B0,4:flag_atbase.bmp><L9>");
else
HUD::AddText(hudDyn, "<B0,4:flag_enemycaptured.bmp><L9>");

Re: Still showing to have the enemies flag

Posted: Thu Oct 18, 2018 7:00 am
by perrinoia
This is the piece of the code that changes the HUD, not the part that detects why to change the HUD. Why are these in separate places? I dunno. It's a very inefficient way to code something.

Let's follow the rabbit hole, shall we?

Find "function Team::GetFlagLocation".

Re: Still showing to have the enemies flag

Posted: Thu Oct 18, 2018 8:58 pm
by KILROY
Would be in the last CS I looked into, but found it in TeamTrak.CS:

function Team::GetFlagLocation(%teamNum) {
return $TeamData::TeamNum[%teamNum, flag];
}

I also found onClientMessage in TeamHud.CS:

function TeamHUD::OnClientMessage(%client, %message) {
if (%client == 0)
return;

if ($TeamHudData::blink[%client] == "")
TeamHUD::Blink(%client, 0);

return;
}