STAR TREK 2d20
Page 2 of 3 First 123 Last
  1. #11

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Sorry, myFile is the fully qualified path to the executable. Again, FG starts, it just gives that message. Do you think the working directory needs to be set to the program's location? The error message kind of makes no sense if that's the case, but I guess it's worth a try.

    Of course, even once FG starts, there is no way I know of to tell it what campaign to launch, so I still have to rely upon the user to start up his campaign.

  2. #12

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Andraax, you are a genius. I had to set the working directory to the install location (which I got from the registry), and the executable name had to be the fully-qualified file name. Just "FantasyGrounds.exe" would not work. Of course, there is still the fact that the user must start his campaign, but at least I got the main program started.

  3. #13
    You can automate the user portion of FG a little bit using either AutoIt or ImageSearch

    For example, if you know exactly on the screen where FG will start, AutoIt works great. For example something like this:
    Code:
    using System;
    using System.Windows.Forms;
    using AutoIt;
    using System.Runtime.InteropServices;
    
    …
    
    System.IO.Directory.SetCurrentDirectory("C:\\Games\\Fantasy Grounds");
    AutoItX.Run("FantasyGrounds.exe", "C:\\Games\\Fantasy Grounds");
    AutoItX.WinWait("Fantasy Grounds");
    
    if (AutoItX.WinActive("Fantasy Grounds") == 0)
    {
        AutoItX.WinActivate("Fantasy Grounds");
    }
    AutoItX.WinWaitActive("Fantasy Grounds");
    AutoItX.Sleep(1000);
    AutoItX.MouseMove(595, 419);
    AutoItX.MouseClick("left");
    AutoItX.Sleep(1000);
    AutoItX.MouseMove(771, 456);
    AutoItX.MouseClick("left");
    AutoItX.Sleep(1000);
    AutoItX.MouseMove(1317, 823);
    AutoItX.MouseClick("left");
    If you do not want to go to a particular place but search the screen for a button, use ImageSearch. For example something like this:
    Code:
    using System;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    
    ...
    
    [DllImport("ImageSearchDLL.dll")]
    private static extern IntPtr ImageSearch(int x, int y, int right, int bottom, [MarshalAs(UnmanagedType.LPStr)]string imagePath);
    
    private bool SearchForImage() {
    string fullImageName = <image looking for, e.g., image of the “Load Campaign” button>
    if (System.IO.File.Exists(fullImageName))
    {
        // pick your own screen coordinates to check instead of these
        IntPtr found = ImageSearch(800, 700, 1100, 900, fullImageName); 
        string foundString = Marshal.PtrToStringAnsi(found);
        if (foundString != "0")
        {
            return true;
        }
    }
    return false;
    }

  4. #14
    Combining these two (AutoIt and ImageSearch) works great for automating stuff like what you are probably trying to do.

    For example, in only ~200 lines of code I combined them in a C# program to automatically roll characters in Baldurs Gate, Icewind Dale, and Temple of Elemental Evil until the combined ability rolls for a character were high enough. (Yes, I know cheating. It was the fun of figuring out how to do it.)

  5. #15

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Wow, I had no idea something like this existed. I will have to stew on this a little. I wasn't too bothered not being able to go farther than the launch screen because the user might not want to run the same campaign as last time. I don't think I want to duplicate the launch screen. Currently, I just put up a dialog that asks the user to startup in host, client, or local mode as desired in the appropriate ruleset/campaign and just keep checking to see if FG has started up fully and written the signal node to the intercommunication xml file.

  6. #16

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    OK, here's the next one:
    Where is client mode CampaignRegistry data stored? I know it is stored because I wrote some test code to set a field inside CampaignRegistry, and it persisted when I shutdown and restarted the client (localhost connected to my own campaign). And I know it isn't in the campaign's CampaignRegistry the host uses because I opened it in Notepad++, and my field wasn't there.

    I am thinking it is crammed into the cache .dat file?

  7. #17
    It’s stored in the client campaign data in the cache. Most of the files except hot keys are stored in an encrypted cache to prevent player peeking.

    Regards,
    JPG

  8. #18

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Just curious. Thanks!

    One thing I will say is the more I get into the ruleset (corerpg) and the lua xml thing, the more I admire the design of the whole thing. Really remarkable.

  9. #19

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    I am just using this thread for questions so as to avoid thread proliferation.

    This is a question for Moon Wizard or Trenloe (although is someone else knows the answer, I'm listening).
    Comm has two ThrowDice functions. The second has the signature: function throwDice( data )

    The question: Is this function asynchronous? That is, will a call result in an immediate return followed by an onDiceLanded at a later point?
    What if there are no dice in the call?

    I am asking this because I am trying to implement an onTime event kind of structure, to where I can call something asynchronously so that the user interface stays responsive while we are waiting on the time to arrive.

  10. #20
    If there are dice, the physics simulation is kicked off, and onDiceLanded is called when the simulation completes. If there are no dice; then I believe it’s an immediate call to onDiceLanded.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in