Jump to content
The simFlight Network Forums
jr2mey

IPC.GET and IPC.SET question

Recommended Posts

Hello,

Learning LUA.

Did I read it correctly that with ipc.set and ipc.get I can set a set and read a lua global and have it read across client computers?

If so, I haven't been able to accomplish this with rudimentary script below.  I can achieve it if done on the same client computer, but not across PC's.

The computers I use have been a working stable platform in my 737 sim for many years using FSUICP and wideclient.  So my thoughts are that I am not writing the script correctly or that the global isn't able to be sent from one computer to another.

 

Example:

COMP1

ipc.set("Depart",0)

function Gate ()

    pwr=ipc.readUB(0x562A)
    extpwravail=logic.And(pwr,1)                            -- (1) External power available
    
    SeatBeltOn=ipc.readUB(0x5640)>=1

    if (extpwravail==1) and (SeatBeltOn) then
        ipc.control(66695)
        ipc.sleep(500)    
        ipc.display("Boarding in progress", 3, 15)            
        ipc.set("Depart",1)
    end
end

event.offsetmask(0x562A,1,"UB","Gate")         -- Extpwravail
event.offset(0x5640,"UB","Gate")            -- SeatBelts

 

 

COMP2

Depart=ipc.get("Depart")
function xcomm ()

    com=ipc.get("Depart")

    call=ipc.readUB(0x5646)                    
    callgnd=logic.And(call,1)~=0                -- (1) ground call button. bit 1

    if  (com==1) and (callgnd) then
        sound.play("comck")
    end
end     

event.offsetmask(0x5646,1,"UB","xcomm")               -- (1) ground call 1

 

 

 

 

 

Share this post


Link to post
Share on other sites
9 hours ago, jr2mey said:

Did I read it correctly that with ipc.set and ipc.get I can set a set and read a lua global and have it read across client computers?

Yes,  But check that you have WideLuaGlobals=Yes in the [General] section of the FSYUPIC INI file.

How are you loading the COMP1 lua (I assume that's the flight sim one?). The one loaded by WideClient will run directly WideClient connects.

This line in COMP2 is redundant:

Depart=ipc.get("Depart")

but I don't see anything wrong.  Are you using up to date versions of FSUIPC and WideClient -- the Global facility was a later addition.

Pete

 

Share this post


Link to post
Share on other sites
31 minutes ago, Pete Dowson said:

Yes,  But check that you have WideLuaGlobals=Yes in the [General] section of the FSYUPIC INI file.

Hello Sir, Yes I have checked the WideLuaGlobals=Yes in the General section and it is marked with yes.

 

33 minutes ago, Pete Dowson said:

How are you loading the COMP1 lua (I assume that's the flight sim one?). The one loaded by WideClient will run directly WideClient connects.

I should better clarify.  Both Comp1 and Comp2 are individual computers both running wide client ver 6.999v4.  P3DV4 on a completely different computer from where these scripts are being used, is running FSUICP Ver 5.14.  Am I required to initiate the global from FSUICP or can I "ipc.set" a global in one wide client computer and "ipc.get" a global on another wide client computer?

Does that help clarify or confuse more?

 

42 minutes ago, Pete Dowson said:

This line in COMP2 is redundant:

Depart=ipc.get("Depart")

Thank you sir.  I cleaned that portion out.  It was getting too late at night when I was putting together this question in the forum.

By the way.  Been using your applications since fs9 came out.  Just want to take a second and thank you for the years of use I have gotten from your work and where it has brought my simulator in the level of realism. Thank you. 

Share this post


Link to post
Share on other sites
3 hours ago, jr2mey said:

Both Comp1 and Comp2 are individual computers both running wide client ver 6.999v4.  P3DV4 on a completely different computer from where these scripts are being used, is running FSUICP Ver 5.14.

This error is now corrected. Now all wide client computers running Ver 7.156 and FSUICP is Ver 5.15.  I really thought i had updated all computers. The previous sentence is why I never like to ask questions on the forums; it shows my stupid for all to see... LOL

Still having the same issue however.  I know its something I am doing wrong.

Share this post


Link to post
Share on other sites
17 hours ago, jr2mey said:

Am I required to initiate the global from FSUICP or can I "ipc.set" a global in one wide client computer and "ipc.get" a global on another wide client computer?

Ah, no. There is no Client to Client sharing of globals, only Sim PC globals transmitted to clients. and not vice versa nor between clients.

You'd need to use offsets instead. FSUIPC contains these values, and all clients can read and write them. Offsets 66C0-66FF are free for users to use for anything.

Pete

 

Share this post


Link to post
Share on other sites
5 hours ago, Pete Dowson said:

Ah, no. There is no Client to Client sharing of globals, only Sim PC globals transmitted to clients. and not vice versa nor between clients.

Ok, got it, thank you very much Sir.  Really appreciate the quick support!

Regards,

James

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.