Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2010
851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #/ LevelEditor>Template::Morten1337
  2. #/ Template q for creating new "tools"
  3. %include "leveleditor_template.qb_table.qbi"   #/ Table file
  4.  
  5. #///////////////////////////////////////////
  6. #//Spawn the object/ do action?
  7. :i function $Leveleditor_SpawnTemplate$
  8. :i $LevelEditor$.$GetCursorPosition$
  9. #///////////////////////////////////////////
  10. #//This will generate a unique name/checksum
  11. #//"gen_global_num" is a inteeger located in "leveleditor.qb"
  12. :i %GLOBAL%$num$ = (($gen_global_num$) + %i(1,00000001))
  13. :i call $change$ arguments
  14.         $gen_global_num$ = %GLOBAL%$num$
  15. :i %GLOBAL%$name$ = ($gen_Template$+%GLOBAL%$num$)
  16. #// ex %GLOBAL%$name$ = "gen_Template09",  09 = num(gen_global_num + 1)
  17.  
  18.     :i $CreateCompositeObject$:s{
  19.         :i $Components$ =
  20.         :i :a{
  21.             :i :s{$component$ = $motion$:s}
  22.             #//$motion$ is a MUST! if not, Obj_ functions will not work.
  23.         :i :a}
  24.         :i $params$ = :s{$pos$ = (%GLOBAL%$pos$ - %vec3(0.000000,20.000000,0.000000))$name$ = %GLOBAL%$name$:s}
  25.             #//%GLOBAL%$pos$ is $LevelEditor$.$GetCursorPosition$, name is %GLOBAL%$name$ see line 16
  26.     :i :s}
  27.     #//Set the orientation of the object to the same as the "cursor"
  28.     :i %GLOBAL%$name$.call $Obj_SetOrientation$ arguments
  29.             $y$ = %GLOBAL%$angle$
  30. :i endfunction
  31.  
  32. #///////////////////////////////////////////
  33. #//The menu that spawns when you press triangle
  34. :i function $LevelEditor_m_template_settings$
  35.     :i call $pause_menu_gradient$ arguments
  36.             $on$
  37.     :i $SelectionArrow_Destroy$
  38.     :i call $KillSpawnedScript$ arguments
  39.             $name$ = $SelectionArrow_Create$
  40.     :i call $KillSpawnedScript$ arguments
  41.             $name$ = $LevelEditor_Debug_text$
  42.         :i if call $ObjectExists$ arguments
  43.                 $id$ = $debug_info_id$
  44.             :i call $DestroyScreenElement$ arguments
  45.                 $id$ = $debug_info_id$
  46.         :i endif       
  47.         :i call $DestroyScreenElement$ arguments
  48.                 $id$ = $LevelEditor_buttons_id$
  49.  
  50.             :i if call $ObjectExists$ arguments
  51.                 $id$ = $current_menu_anchor$
  52.             :i call $DestroyScreenElement$ arguments
  53.                 $id$ = $current_menu_anchor$
  54.         :i endif
  55.         :i $console_hide$
  56.         :i call $make_new_themed_sub_menu$ arguments
  57.                 $title$ = %s(0,"")$no_grad_bar$
  58.         :i $SetScreenElementProps$:s{
  59.             :i $id$ = $sub_menu$
  60.             :i $event_handlers$ = :a{:s{call $pad_back$ arguments
  61.                         $generic_menu_pad_back$$params$ = :s{$callback$ = $leveleditor_menu_exit$:s}:s}:a}
  62.             :i $replace_handlers$
  63.         :i :s}
  64.  
  65.         :i $theme_menu_add_item$:s{
  66.             :i $text$ = %s(0,"First item")
  67.             #/:i $no_bg$
  68.             :i $first_item$
  69.             :i $text_pos$ = %vec2(70.000000,-5.000000)
  70.             :i $centered$ = %i(1,00000001)
  71.             :i $pad_choose_script$ = $nullscript$
  72.         :i :s}
  73.         :i $theme_menu_add_item$:s{$text$ = %s(0,"Second item")
  74.             :i $id$ = $menu_id_here$
  75.             :i $extra_text$ = %s(0,"null")
  76.             :i $text_pos$ = %vec2(70.000000,-5.000000)
  77.             :i $pad_choose_script$ = $nullscript$
  78.         :i :s}
  79.         :i $theme_menu_add_item$:s{
  80.             :i $text$ = %s(4,"Done")
  81.             :i $pad_choose_script$ = $leveleditor_menu_exit$
  82.             :i $last_item$
  83.             :i $centered$ = %i(1,00000001)
  84.             :i $last_menu_item$ = %i(1,00000001)
  85.         :i :s}
  86.     :i $finish_themed_sub_menu$
  87.     :i call $SetScreenElementProps$ arguments
  88.             $id$ = $root_window$$tags$ = :s{$menu_state$ = $on$:s}
  89.     :i $LevelEditor$.$Suspend$
  90. :i endfunction
  91.  
  92. #////////////////////////////////////////////////////////
  93. #//array for the next function, see line 107
  94. :i $leveleditor_template_array$ = :a{
  95.     :i :s{
  96.             :i $something$ = $something01$
  97.             :i $name$ = %s(0,"something01")
  98.     :i :s}
  99.     :i :s{
  100.             :i $something$ = $something02$
  101.             :i $name$ = %s(0,"something02")
  102.     :i :s}
  103. :i :a}
  104.  
  105. #////////////////////////////////////////////////////////
  106. #//Creates a from array elements, good for listing stuff.
  107. :i function $LevelEditor_m_template_list$
  108. :i $leveleditor_menu_exit$
  109. :i call $pause_menu_gradient$ arguments
  110.         $on$
  111. :i $SelectionArrow_Destroy$
  112. :i call $KillSpawnedScript$ arguments
  113.         $name$ = $SelectionArrow_Create$
  114. :i call $KillSpawnedScript$ arguments
  115.         $name$ = $LevelEditor_Debug_text$
  116.     :i if call $ObjectExists$ arguments
  117.             $id$ = $debug_info_id$
  118.         :i call $DestroyScreenElement$ arguments
  119.             $id$ = $debug_info_id$
  120.     :i endif       
  121.     :i call $DestroyScreenElement$ arguments
  122.             $id$ = $LevelEditor_buttons_id$
  123.  
  124.         :i if call $ObjectExists$ arguments
  125.             $id$ = $current_menu_anchor$
  126.         :i call $DestroyScreenElement$ arguments
  127.             $id$ = $current_menu_anchor$
  128.     :i endif
  129.     :i $leveleditor$.$Suspend$
  130.     :i $console_hide$
  131.     :i call $make_new_themed_scrolling_menu$ arguments
  132.         $title$ = %s(9,"Menu Title")$no_bar$
  133.     :i $SetScreenElementProps$:s{
  134.         :i $id$ = $sub_menu$
  135.         :i $event_handlers$ = :a{:s{call $pad_back$ arguments
  136.                     $generic_menu_pad_back$$params$ = :s{$callback$ = $leveleditor_menu_exit$:s}:s}:a}
  137.         :i $replace_handlers$
  138.     :i :s}
  139.     :i %GLOBAL%$array_name$ = $leveleditor_template_array$
  140.     :i call $GetArraySize$ arguments
  141.             %GLOBAL%$array_name$
  142.  
  143.     :i %GLOBAL%$index$ = %i(0,00000000)
  144.     :i while
  145.    
  146.         $text$ = ((%GLOBAL%$array_name$:a{%GLOBAL%$index$:a}) ->$name$)
  147.         $something$ = ((%GLOBAL%$array_name$:a{%GLOBAL%$index$:a}) ->$something$)
  148.  
  149.         :i $theme_menu_add_item$:s{
  150.             :i $text$ = %GLOBAL%$text$
  151.             :i $no_bg$
  152.             :i $centered$
  153.             :i $pad_choose_script$ = $nullscript$
  154.             :i $pad_choose_params$ = :s{$something$ = %GLOBAL%$something$$index$ = %GLOBAL%$index$:s}  
  155.         :i :s}
  156.        
  157.     :i %GLOBAL%$index$ =  (%GLOBAL%$index$ + %i(1,00000001))
  158.     :i loop_to %GLOBAL%$array_size$
  159.     :i $finish_themed_scrolling_menu$
  160.     :i call $SetScreenElementProps$ arguments
  161.             $id$ = $root_window$$tags$ = :s{$menu_state$ = $on$:s}
  162. :i endfunction
  163.  
  164. :i :end
  165. #/ END....., no shit?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement