X
 
  • Filtre
  • Heure
  • Afficher
Tout nettoyer
nouveaux messages

  • Menus personnalisés

    Merci à LV EN COURS

    LV's Terran Conflict Script Index

    Tutoriel - Ajouter un menu personnalisé
    ___________

    note : http://code.google.com/p/x3tcscripts/
    ____________

    D'abord vous pouvez installer le téléchargement dans voter dossier X3 qui contient les scripts tutoriels.

    Zip
    Cycrow Installer Version

    Une fois installé vous aurez besoin du fichier 8800-L044 t dans votre dossier t.



    Voici le fichier text du fichier t :

    Code:
    <language id="44"> // english (49 is german)
    −
    <page id="2008" title="Script Object Commands" descr="0">
    <t id="1309">A_LV_TUTORIAL_MENU</t>
    </page> \\ creates the command shown lower in the "Custom" interface
    −
    <page id="2010" title="Script Cmd Names" descr="Long version of commandos. These are the commandos assigned to ships using the commandconsole. Page 2010 and 2011 belong together and hold short and long versions of the same commands">
    <t id="1309">Open Tutorial Interface</t>
    </page>
    −
    <page id="2011" title="Script Cmd Shorts" descr="Short version of commandos. These are the commandos assigned to ships using the commandconsole. Page 2010 and 2011 belong together and hold short and long versions of the same commands">
    <t id="1309">OTI</t>
    </page>
    −
    <page descr="" id="8800" title="Tutorials">
    <t id="1">\033GChoose a station or ship\033X</t>
    \\makes the text ingame show as green
    <t id="2">You chose \033R%s\033X</t>
    \\shown in the games rss feed ticker bottom left of screen
    <t id="3">Play a sound</t>
    <t id="4">Enter sound number 900-1000</t>
    <t id="5">Open another menu</t>
    <t id="6">Option 1</t>
    <t id="7">Option 2</t>
    <t id="8">Option 3</t>
    <t id="9">Option 4</t>
    <t id="10">Option 5</t>
    <t id="11">Tutorial Interface Main Menu</t>
    <t id="12">Tutorial Interface 1st Menu</t>
    <t id="13">Tutorial Interface 2nd Menu</t>
    <t id="14">Show Some Text In The RRS Feed</t>
    <t id="15">This is tutorial text by \033GLV\033X</t>
    </page>
    </language>

    Les deux fichiers mis en avant seront également dans votre répertoire de scripts, si ils ont été installés correctement.


    Une fois en jeu rendez-vous dans l'éditeur de script qui aura deux scripts vers la fin de la liste :



    Code:
    Script setup.lv.tutorials
    Version: 0
    for Script Engine Version: 41
    Description
    Tutorial scripts for TC scripters
    Arguments
    Source Text
    
    
    001   load text: id=8800
    002   * loads youtr t file
    003   $ware = Cargo Lifesupport System
    004   
    005   add ship custom command: id=1309
    006   * loads the text from your t file to set up a comand in the interface
    007   set script command upgrade: command=A_LV_TUTORIAL_MENU  upgrade=[TRUE]
    008   * upgrade = TRUE means command shows by default
    009   
    010   *set script command upgrade: command=A_LV_TUTORIAL_MENU  upgrade=$ware
    011   * upgrade = ware means unless the ship has the ware installed the command is off
    012   
    013   
    014   global script map: set: key=A_LV_TUTORIAL_MENU, class=Moveable Ship, race=Player, script='tutorial.lv.main', prio=0
    015   * this adds the command to all your ships and calls the script that the comm uses
    016   * command will now show in custom interface.   
    017   return null
    Une fois installé vous aurez dorénavant accès aux commandes dans votre "Custom Menu" :



    Le setup du script est ce qui lie les nouvelles commandes au fichier t.





    Ce qui ouvrira ce menu :



    Choisissez l'option "open another menu" :



    Quand vous sélectionnez la commande :
    Ceci est le script appelé qui se lancera dans le script setup.tutorial initial du dessus.

    global script map: set: key=A_LV_TUTORIAL_MENU, class=Moveable Ship, race=Player, script='tutorial.lv.main', prio=0
    Code:
    Script tutorial.lv.main
    Version: 0
    for Script Engine Version: 41
    Description
    Description
    Arguments
    
    
    Source Text
    
    
    001   $anull = null
    002   
    003   $a = 'a'
    004   $b = 'b'
    005   $c = 'c'
    006   $d = 'd'
    007   $e = 'e'
    008   $f = 'f'
    009   
    010   
    011   $text = sprintf: pageid=8800 textid=11, null, null, null, null, null
    012   $menu =  create custom menu array: heading=$text
    013   
    014   $text = sprintf: pageid=8800 textid=1, null, null, null, null, null
    015   add custom menu item to array $menu: text=$text returnvalue=$a
    016   
    017   $text = sprintf: pageid=8800 textid=3, null, null, null, null, null
    018   add custom menu item to array $menu: text=$text returnvalue=$b
    019   
    020   $text = sprintf: pageid=8800 textid=5, null, null, null, null, null
    021   add custom menu item to array $menu: text=$text returnvalue=$c
    022   
    023   add custom menu item to array $menu: text='Tell Me What Ship I'm In' returnvalue=$d
    024   
    025   $text = sprintf: pageid=8800 textid=14, null, null, null, null, null
    026   add custom menu item to array $menu: text=$text returnvalue=$e
    027   
    028   $text = sprintf: pageid=8800 textid=11, null, null, null, null, null
    029   
    030   add custom menu item to array $menu: text='Monitor For Users Closing Menu Accidently' returnvalue=$f
    031   
    032   loop:
    033 @ = wait 1 ms
    034   $return =  open custom menu: title=$menu description=$text option array=$menu
    035   
    036   
    037   if $return == $a
    038   |$input = [THIS] -> get user input: type=Var/Ship/Station, title='Choose a station or ship'
    039   |$text = sprintf: pageid=8800 textid=2, $input, null, null, null, null
    040   |display subtitle text: text=$text duration=3000 ms
    041   else if $return == $b
    042   |$text = sprintf: pageid=8800 textid=4, null, null, null, null, null
    043   |$menu =  create custom menu array
    044   |add custom menu item to array $menu: text=$text returnvalue='sound'
    045   |$sound =  open custom menu: title=$menu description='try 928' option array=$menu
    046   |$input = [THIS] -> get user input: type=Var/Number, title=$text
    047   |play sample $input
    048   else if $return == $c
    049   |$text = sprintf: pageid=8800 textid=12, $anull, null, null, null, null
    050   |$menu.1 =  create custom menu array: heading=$text
    051   |$text = sprintf: pageid=8800 textid=6, $anull, null, null, null, null
    052   |add custom menu item to array $menu.1: text=$text returnvalue=$f
    053   |$text = sprintf: pageid=8800 textid=7, $anull, null, null, null, null
    054   |add custom menu item to array $menu.1: text=$text returnvalue=$f
    055   |$text = sprintf: pageid=8800 textid=8, $anull, null, null, null, null
    056   |add custom menu item to array $menu.1: text=$text returnvalue=$f
    057   |$text = sprintf: pageid=8800 textid=9, $anull, null, null, null, null
    058   |add custom menu item to array $menu.1: text=$text returnvalue=$f
    059   |$return1 =  open custom menu: title=$menu.1 description='Tutorial' option array=$menu.1
    060   else if $return == $d
    061   |$pship =  get player ship
    062   |$text = 'You are currently flying a ' + $pship
    063   |display subtitle text: text=$text duration=3000 ms
    064   else if $return == $e
    065   |$text = sprintf: pageid=8800 textid=15, $anull, null, null, null, null
    066   |display subtitle text: text=$text duration=3000 ms
    067   else if $return == $f
    068   |display subtitle text: text='Next time the menu appears press del key' duration=3000 ms
    069 @ |= wait 4000 ms
    070   |goto label loop
    071   else if $return == -1
    072   * if del is pressed the rturn value is -1
    073   * make a loop to stop this
    074 @ |= wait 4000 ms
    075   |goto label loop
    076   end
    077   
    078   
    079   
    080   
    081   return null



    Description des éléments principaux et de leurs comportements

    Menus
    Il y a plusieurs manières de créer un menu. Vous pouvez créer un menu, ou créer un ménu et spécifier une entête. Il est conseillé de toujours utiliser cette option si vous planifiez d'utiliser des titres. En effet, si vous créez un menu sans entête et que vous l'ouvrez plus tard, le nom du menu/ses premières lignes deviendra sont titre. Vous pouvez toujours spécifier une entête après cela, mais cela doit être fait immédiatement après. Sinon vous aurez au mieux deux entêtes.


    Info line
    La ligne d'information apparaître en haut de votre menu. Si la ligne de texte est plus large que le menu, le menu s'arrêtera mais le texte lui continuera sur la ligne suivante.

    Heading


    Headings follow the info lines and there can be more than one heading in a menu. Headings need to be placed logically, unlike info lines, they must be placed in the order you want them to appear.


    Items


    Items could also be called options or choices. These lines will give the user a menu item to select which then gives feedback to a script. Items need to follow headings.


    Notes


    You can put multiple headings and items, but you need to do so sequentially to make sure they show up properly.


    For example.


    Add heading 'Commands'
    Add heading 'Cheats'
    Add item 'Remove Command'
    Add item 'Add Command'
    Add item 'Give credits'
    Add item 'Jump to'
    Add item 'Kill target'


    Will come back as...


    Commands
    Cheats
    Remove Command
    Add Command
    Give credits
    Jump to
    Kill target




    Rather than the intended...




    Commands
    Remove Command
    Add Command
    Cheats
    Give credits
    Jump to
    Kill target


    My examples aren't very good I know. But hopefully the information will be useful for those trying to get started with the custom menu's.


    And one Neat Trick I just learned.


    Menu items can be pressed into service as pseudo info lines.


    By making the return value on a menu item NULL, it becomes unselectable.


    As an example; if you had a menu that loaded a list of specific ships, say all M5 ships in a specified wing and there is a chance that their might not be any M5's in that wing. In which case your menu would be empty. You could when that condition is met (no M5's) add a menu item with a null return value that says "No M5 ships in this wing."


    This prevents you from continuing while making it clear why and keeping that menu on screen. It won't close out because the NULL value apparently doesn't count. Which leaves the user free to choose another option if there are any present.


    If you hit escape it will however return NULL, so make sure you put in a check to convert NULL to -1.[/quote]


    Envoyé par Cycrow
    Id just like to confirm a few things about the menu system


    Envoyé par Draslin
    You can't specify a heading after creating the menu to fix it, you'll only end up with a second heading.

    you can add a heading after creating the menu, as long as its the first thing you do.


    ie,
    Code:
    $menu = create menu array
    add heading to menu $menu...



    one other thing you can do with custom menus. Is the menu array is simply just a normal array, so this can be used to display a list of ships quite simply


    Code:
    $ships = get ship array: moveable ship race=Player
    $ret = open custom menu: title=, desc=, array=$ships

    and this will list all ships in the array and return its position, so if you select the first one, $ret will be 0 so you can get the item after by doing


    Code:
    if $ret != -1
      $ship = $ships[$ret]
    end

    $ret is always -1 when esc is pressed so make sure you dont use that as any of your return values. Also, using 0 as a return value wont work either, as the menu system sees that as null instead
Chargement...
X