Announcement

Collapse
No announcement yet.

Unable to "push" variables from UScript to Flash

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to "push" variables from UScript to Flash

    Hello :-/

    I'm trying to push a variable from unrealscript to flash. This is really getting on my nerves since this is not the first time I do this, but for some reason I can't do it this time, even if I've done it a lot of times before :-/

    This is my unrealscirpt code, inside a GFxSomething class. I'm even going back to the basis and trying to send a simple number instead of one of the variables I actually need to send, but still can't get it to work:

    Code:
    function UpdateInventorySlots()
    {
      local float SlotTest;
    
      SlotTest = 5;//EP.SlotItemId1;
      `log ("function UpdateInventorySlots " @SlotTest);
    
      //get variables
      InventoryMC.SetFloat("Slot1", SlotTest);
    }
    My flash code:
    Code:
    var itemData:Object = [
    	{type:"item",asset:0}, //2 bottle
    	{type:"item",asset:1}, //3 bloody bottle
    	{type:"item",asset:2}, //4 gear
    	{type:"item",asset:3}, //5 angel key
    	{type:"item",asset:4}, //6 circle key
    	{type:"item",asset:5}, //7 elevator key
    	{type:"item",asset:6}, //8 gear key
    	{type:"item",asset:7}, //9 rusty key
    	{type:"item",asset:8}, //10 star key
    	{type:"item",asset:9}, //lever
    	{type:"item",asset:10}, //painting piece 1
    	{type:"item",asset:11}, //painting piece 2
    	{type:"item",asset:12}, //painting piece 3	
    	{type:"item",asset:13}, //seal 1
    	{type:"item",asset:14}, //seal 2
    	{type:"item",asset:15}, //seal 3
    	{type:"item",asset:16}, //seal 4
    	{type:"item",asset:17}, //seal 5
    	{type:"item",asset:18}, //seal 6
    	{type:"item",asset:19}, //seal 7
    	{type:"item",asset:20} //wood
    	//{type:"item",asset:7,quantity:3}
    ];
    
    var Slot1:Number = 1;
    
    itemSlot1.data = itemData[Slot1];
    itemSlot2.data = itemData[5];
    I'm using the InventoryDemo file as a base for my experiment. This is what I did:
    replaced the icons with my own icons inside the "icons" movieclip.
    I have the movieclip "inventory" in "_root" that contains the grid of inventory slots, and a keyframe where I've written the code above. For this reason, I made a couple of references to that movieclip in my unreal class:
    Code:
    function bool Start(optional bool StartPaused = false)
    {
      super.Start();
      Advance(0);
    
      RootMC = GetVariableObject("_root");
      InventoryMC = RootMC.GetObject("inventory");
    Inside that "inventory" movie clip I have the different instances of the inventory, named from Slot1 to Slot15 or something like that.

    If I use "itemslot1.data = itemData[5]" the corresponding icon appears. However, I can't seem to read the variable I'm sending from UnrealScript. I'm not sure if I've missed part of the code, or I'm loading the things in the wrong order.

    Help pliz
Working...
X