I want to reference the value of a variable from another Verse file.

If I want to reference and use the value of a variable from VerseDevice file A in VerseDevice file B, how can I retrieve the value?

Well you would need to reference the device itself

eg @editable MyOtherDevice : my_other_verse_device_name = my_other_verse_device_name{} then Print("{MyOtherDevice.Value}")

What does the part my_other_verse_device_name refer to? Is it the name of the module in the Verse file, the name of the Verse object in the editor, or the name of the file where the Verse was originally created?

It’s referring to this, which should be the name of your device

If a Verse file named A contains the following code:

public_module := module:
public_submodule := module:
PublicInt:int = 1

Then, in a Verse file named B, can PublicInt be accessed directly using the following code?

using { public_module }
using { public_submodule }

I tried this approach, but PublicInt was not recognized. Is my understanding correct?

The idea is that the variable PublicInt, which is being used in file B, should retain its state while being referenced in file A for comparisons or other operations.

1 Like

Should become this

public_module := module:
public_submodule<public> := module:
PublicInt<public>:int = 1

Yes, that’s right! Thank you!

If the file A is written as follows, can it be used directly in B?

A:
public_module := module:
public_submodule := module:
PublicInt:int = 1

B:
using { public_module }
using { public_submodule }

if(AgentData := AgentMap[Agent]):
var EliminationInt : int := PublicInt
if (EliminationInt < PurchaseData.Price):

   return

Yea I see no reason for it not to be able to. (Just make sure to add for them to be accessible as mentioned above )

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.