Mod Tool/Scripting: Difference between revisions

cleaning MT main page later when all the script pieces have been transfered over here
(PPG stuff)
(cleaning MT main page later when all the script pieces have been transfered over here)
Line 61: Line 61:


===Read registry===
===Read registry===
Mod Tool (because 32-bit) fails to execute following code properly on 64-bit operation systems. So the code must be build as 64-bit '''and''' 32-bit application.
Mod Tool (because 32-bit) fails to execute following code properly on 64-bit operation systems.
 
So the code must be build as 64-bit program on 64-bit OS '''and''' 32-bit program on 32-bit OS.
 
  Set WshShell = CreateObject("WScript.Shell")
  Set WshShell = CreateObject("WScript.Shell")
  AE_path = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}_is1\InstallLocation")
  AE_path = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}_is1\InstallLocation")
Line 456: Line 459:
===Property Page===
===Property Page===
====Detect a PPG====
====Detect a PPG====
' this check is used to decide to either build or open a PPG
  set oRoot = ActiveProject.ActiveScene.Root
  set oRoot = ActiveProject.ActiveScene.Root
  if typename(oRoot.Properties("my_PPG")) = "Nothing" then
  if typename(oRoot.Properties("my_PPG")) = "Nothing" then
Line 462: Line 466:
  logmessage "found my_PPG"
  logmessage "found my_PPG"
  end if
  end if
====Disable PPG popups====
' let's say a big amount of objects will be created and each object will open a PPG
' in that case for user convenience those PPG popups should be disabled
' disable PPG popup
Preferences.SetPreferenceValue "Interaction.autoinspect", false
' creates the cube mesh but no PPG will show up
CreatePrim "Cube", "MeshSurface"
' enable PPG popup again
Preferences.SetPreferenceValue "Interaction.autoinspect", true




====Build a PPG====
====Build a PPG====
' general PPG setup
' general PPG setup
set oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "my_PPG")
set oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "my_PPG")
set oPPGLayout = oPSet.PPGLayout
set oPPGLayout = oPSet.PPGLayout
   
   
' PPG content
' PPG content
' [...]
' [...]
   
   
' open PPG
' open PPG
InspectObj oPSet
InspectObj oPSet




====PPG content====
====PPG content====
=====Droplist=====
=====Droplist=====
oPSet.AddParameter3 "Team", siString, 0
oPSet.AddParameter3 "Team", siString, 0
aListTeams = Array( "Konoko", 0, _
aListTeams = Array( "Konoko", 0, _
"TCTF", 1, _
"TCTF", 1, _
"Syndicate", 2, _
"Syndicate", 2, _
"Neutral", 3, _
"Neutral", 3, _
"SecurityGuard", 4, _
"SecurityGuard", 4, _
"RogueKonoko", 5, _
"RogueKonoko", 5, _
"Switzerland (is melee-immune)", 6, _
"Switzerland (is melee-immune)", 6, _
"SyndicateAccessory", 7 )
"SyndicateAccessory", 7 )
oPPGLayout.AddEnumControl "Team", aListTeams, "", siControlCombo
oPPGLayout.AddEnumControl "Team", aListTeams, "", siControlCombo




=====Radio options=====
=====Radio options=====
oPSet.AddParameter3 "Team", siString, 0
oPSet.AddParameter3 "Team", siString, 0
aListTeams = Array( "Konoko", 0, _
aListTeams = Array( "Konoko", 0, _
"TCTF", 1, _
"TCTF", 1, _
"Syndicate", 2, _
"Syndicate", 2, _
"Neutral", 3, _
"Neutral", 3, _
"SecurityGuard", 4, _
"SecurityGuard", 4, _
"RogueKonoko", 5, _
"RogueKonoko", 5, _
"Switzerland (is melee-immune)", 6, _
"Switzerland (is melee-immune)", 6, _
"SyndicateAccessory", 7 )
"SyndicateAccessory", 7 )
oPPGLayout.AddEnumControl "Team", aListTeams, "", siControlRadio
oPPGLayout.AddEnumControl "Team", aListTeams, "", siControlRadio
 
 
=====Checkbox=====
' create checkbox and remove key symboles by setting parameter "Animatable" to false (after siBool)
oPSet.AddParameter3 "Check1", siBool, 0, , , false
oPPGLayout.AddItem "Check1", "Checkbox_caption"




=====Spacer=====
=====Spacer=====
' AddSpacer( [Width], [Height] )
' AddSpacer( [Width], [Height] )
oPPGLayout.AddSpacer 25
oPPGLayout.AddSpacer 25




[[Category:Windows-only modding tools]]
[[Category:Windows-only modding tools]]
8,452

edits