Advertisement
expired6978

Scaleform/Papyrus API

Apr 7th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. Papyrus -> Scaleform
  2.  
  3. Var UI.Get("menuname", "variablepath")
  4. bool UI.Set("menuname", "variablepath", Var)
  5.  
  6. Struct DataContainer
  7. int handle
  8. EndStruct
  9.  
  10. Var[] g = new Var[2]
  11. g[0] = "str1"
  12. g[1] = "str2"
  13.  
  14. Var[] p = new Var[4]
  15. p[0] = 3.0 as float
  16. p[1] = PackArray(g)
  17. p[2] = "str3"
  18. p[3] = 0
  19.  
  20. DataContainer arguments = PackArray(p)
  21.  
  22. Var k = UI.Invoke("menuname", "variablepath", arguments)
  23.  
  24. DataContainer retn = k as DataContainer
  25.  
  26. Var[] v = UnpackArray(retn)
  27.  
  28. DestroyContainer(arguments) ; We are done with the arguments pack
  29. DestroyContainer(retn) ; We are done with the return data
  30.  
  31. DataContainer PackArray(Var[])
  32. Var[] UnpackArray(DataContainer)
  33.  
  34. DestroyContainer(DataContainer)
  35.  
  36. bool IsDictionary(DataContainer) ; True for maps or objects
  37. bool IsArray(DataContainer)
  38.  
  39.  
  40. Scaleform -> Papyrus
  41.  
  42.  
  43. RegisterForExternalEvent("SomeEvent", "OnCallback")
  44.  
  45. GFX Call:
  46. SendExternalEvent("SomeEvent", vars[])
  47.  
  48. GFx to PVM Adapter:
  49.  
  50. VMArray<VMVariable> arr; // This will be converted to flat parameter list unless it contains other arrays
  51. for i in vars
  52. // Handle Form/Script types
  53. if var[i] is Object and var[i].HasMember("handle_high") and var[i].HasMember("handle_low") and var[i].HasMember("Scriptname")
  54. Pack as Scriptname type
  55.  
  56. // Handle Object types
  57. else if var[i] is Object
  58. create DataContainer pack its hierarchy recursively
  59.  
  60. // Handle Array of types
  61. else if var[i] is Array
  62. if var[i] has all same types
  63. PackValue as array of that type
  64. else
  65. PackValue as array of Var, pack recursively
  66. else if var[i] is primitive
  67. PackValue(var[i])
  68. else
  69. ????
  70.  
  71.  
  72. Scaleform:
  73. SendExternalEvent("SomeEvent", ["str1", {"handle_high":0x00FFFFFF, "handle_low":0x00000000, "Scriptname":"Billy"}, {"d1": 1.0, "d2": 23}, [1, 2, 3]]);
  74.  
  75. ; Papyrus Receive call
  76. Event OnCallback(string s1, Billy billyForm, DataContainer d, int[] arr)
  77. ; )
  78. EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement