Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   New Scripting Possibilities in Release candidate patch. (http://forum.fulqrumpublishing.com/showthread.php?t=34676)

FG28_Kodiak 09-30-2012 06:23 PM

New Scripting Possibilities in Release candidate patch.
 
With the new patch its possible to get the Mission time.

Code:

double t = GamePlay.gpTimeofDay();
it's a double so you must convert it into time Format.
Code:

    static string CreateTimeString(double num)
    {
        double hours = Math.Floor(num);
        double minutes = (num - hours) * 60.0;
        double seconds = (minutes - Math.Floor(minutes)) * 60.0; 
        int H = (int)Math.Floor(hours);
        int M = (int)Math.Floor(minutes);
        int S = (int)Math.Floor(seconds); 
        return H.ToString() + ":" + M.ToString() + ":" + S.ToString();
    }


Also we get the possibility to set lables, but i had no luck to get it to work. So maybe others can give me a hint how to use it. :rolleyes:

theOden 09-30-2012 07:39 PM

Regarding labels I've tried:

Code:

    public override void OnUserCreateUserLabel(GPUserLabel ul)
    {
        //Player ulPlayer = ul.Player;
        GamePlay.gpLogServer(null, "Marker: {0}", new object[] { ul.Text });
        GamePlay.gpDrawUserLabel(ul);
    }

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
                base.OnPlaceEnter(player, actor, placeIndex);
               
        //Point2d startPoint2d = new Point2d(actor.Pos().x, actor.Pos().y);
        //GPUserLabel userLabel = GamePlay.gpMakeUserLabel(startPoint2d, player, player.Name(), GamePlay.gpTimeofDay(), 0);
        //GamePlay.gpDrawUserLabel(player.Army(), userLabel);
        //GamePlay.gpLogServer(new Player[] { player }, " Hello {0} in {1}!", new object[] { bobDesignation((actor as AiAircraft).InternalTypeName()), userLabel.Text });
        //GamePlay.gpLogServer(null, " Hello {0} in {1}!", new object[] { bobDesignation((actor as AiAircraft).InternalTypeName()), userLabel.Text });
... etc

But no joy (I can use label properties but nothing visible on map).
(Also, pressing enter creating a new label in map window fires my guns :-| )

Hopefully someone nails the usage of the new label features.

41Sqn_Banks 10-07-2012 12:22 AM

Didn't have luck with user labels too:(

salmo 10-07-2012 01:10 AM

I tried scripting labels as well. No compiler errors, but no labels for ground object displayed in online mission. I wonder whether labels are only displayed with icons-on server settings?

41Sqn_Banks 10-07-2012 06:54 AM

Quote:

Originally Posted by salmo (Post 467563)
I tried scripting labels as well. No compiler errors, but no labels for ground object displayed in online mission. I wonder whether labels are only displayed with icons-on server settings?

I did a test with all icon stuff enabled, no success.

FG28_Kodiak 10-07-2012 07:22 AM

Me too,

i got the OnUserCreateUserLabel Event in single player but not in Multiplayer and Dedi. In all cases no Icon was shown. So it seems to be a Bug. :rolleyes:

Ataros 10-09-2012 07:32 AM

You may try test.zip sample from this post http://www.sukhoi.ru/forum/showthrea...=1#post1902755
or ask Naryv for details if it does not help.

41Sqn_Banks 10-11-2012 10:47 AM

Response from naryv about user label: http://www.sukhoi.ru/forum/showthrea...=1#post1906802

FG28_Kodiak 10-11-2012 10:51 AM

Ive tried it on a Dedi-Server without result, so ...

41Sqn_Banks 10-11-2012 10:56 AM

Quote:

Originally Posted by FG28_Kodiak (Post 468451)
Ive tried it on a Dedi-Server without result, so ...

Maybe it's working only with a player hosted server?

The example code of naryv doesn't use the gpMakeUserLabel method, it only shows a label created from a player to other players. I will try out naryv's example code, to see if the labels are displayed there. I only need a second player to test it ...


All times are GMT. The time now is 10:28 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.