Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0125· openaiHugging Face Suzhen/CodeChat

сделайте следующий switch, чтобы при {{bms}} была только стандартная иконка. А при…

  1. User

    сделайте следующий switch, чтобы при {{bms}} была только стандартная иконка. А при {{bms12}} выходила иконка 2012, как здесь: make switch here: {{doc|docpage=Template:Hl2/doc}} {{Software | {{{1|}}} | ico = Bms icon.png | ico size = 16px | link = Black Mesa (Source) | name = {{Autolang | Black Mesa | zh = 黑山 }} | name0 = bms | name1 = {{Autolang | Black Mesa: Source | zh = 黑山:起源 }} | name2 = {{Autolang | Black Mesa: Definitive Edition }} | suf = {{{suf|}}} | col = #E57126 | addtext = {{{addtext|}}} | nt = {{{nt|}}} }} with it: {{doc|docpage=Template:Hl2/doc}} {{Software | {{{1|}}} | ico = Bms icon2012.png | ico size = 16px | link = Black Mesa (Source) | name = {{Autolang | Black Mesa | zh = 黑山 }} | name0 = bms | name1 = {{Autolang | Black Mesa: Source | zh = 黑山:起源 }} | name2 = {{Autolang | Black Mesa 2012 }} | name3 = {{Autolang | Black Mesa 2012 (Mod) }} | name4 = {{Autolang | Black Mesa 2012 }} | suf = {{{suf|}}} | col = #ffffff | addtext = {{{addtext|}}} | nt = {{{nt|}}} }}

  2. Assistant

    To achieve the desired switch, you can modify the existing code as follows:

    Original code:

    {{Software
    | {{{1|}}}
    | ico = Bms icon.png
    | ico size = 16px
    | link = Black Mesa (Source)
    | name = {{Autolang
        | Black Mesa
        | zh = 黑山
        }}
    | name0 = bms
    | name1 = {{Autolang
        | Black Mesa: Source
        | zh = 黑山:起源
        }}
    | name2 = {{Autolang
        | Black Mesa: Definitive Edition
        }}
    | suf = {{{suf|}}}
    | col = #E57126
    | addtext = {{{addtext|}}}
    | nt = {{{nt|}}}
    }}
    

    Updated code with the switch:

    {{#switch: {{{1|}}}
    | bms12 = {{Software
        | ico = Bms icon2012.png
        | ico size = 16px
        | link = Black Mesa (Source)
        | name = {{Autolang
            | Black Mesa
            | zh = 黑山
            }}
        | name2 = {{Autolang
            | Black Mesa 2012
            }}
        | suf = {{{suf|}}}
        | col = #ffffff
        | addtext = {{{addtext|}}}
        | nt = {{{nt|}}}
        }}
    | #default = {{Software
        | ico = Bms icon.png
        | ico size = 16px
        | link = Black Mesa (Source)
        | name = {{Autolang
            | Black Mesa
            | zh = 黑山
            }}
        | name0 = bms
        | name1 = {{Autolang
            | Black Mesa: Source
            | zh = 黑山:起源
            }}
        | name2 = {{Autolang
            | Black Mesa: Definitive Edition
            }}
        | suf = {{{suf|}}}
        | col = #E57126
        | addtext = {{{addtext|}}}
        | nt = {{{nt|}}}
        }}
    }}
    

    With this switch implemented, when the parameter is set to bms, the standard icon will be displayed. When the parameter is set to bms12, the 2012 icon will be displayed.

  3. User

    я использую и появляется две иконки,вы похоже ошиблись в коде и в том числе loop template

  4. Assistant

    Извините за путаницу. Вот исправленный код для шаблона с использованием switch, чтобы показывалась только одна иконка в зависимости от переданного параметра:

    <includeonly><onlyinclude>{{#switch: {{{1|}}}
    | bms12 = {{Software
        | ico = Bms icon2012.png
        | ico size = 16px
        | link = Black Mesa (Source)
        | name = {{Autolang
            | Black Mesa
            | zh = 黑山
            }}
        | name2 = {{Autolang
            | Black Mesa 2012
            }}
        | suf = {{{suf|}}}
        | col = #ffffff
        | addtext = {{{addtext|}}}
        | nt = {{{nt|}}}
        }}
    | #default = {{Software
        | ico = Bms icon.png
        | ico size = 16px
        | link = Black Mesa (Source)
        | name = {{Autolang
            | Black Mesa
            | zh = 黑山
            }}
        | name0 = bms
        | name1 = {{Autolang
            | Black Mesa: Source
            | zh = 黑山:起源
            }}
        | name2 = {{Autolang
            | Black Mesa: Definitive Edition
            }}
        | suf = {{{suf|}}}
        | col = #E57126
        | addtext = {{{addtext|}}}
        | nt = {{{nt|}}}
        }}
    }}
    

    Этот код позволит показывать только стандартную или иконку 2012 в зависимости от параметра bms или bms12. Сверьтесь с этим обновленным кодом для корректного отображения иконки.

  5. User

    how it works now

  6. Assistant

    The updated code snippet you provided will work as follows:

    • If the parameter passed in is bms12, it will display the software block with the 2012 icon and corresponding information.
    • If the parameter passed in is any other value or if no parameter is provided, it will default to displaying the software block with the standard icon and information.

    This switch statement ensures that only one of the two software blocks (with the 2012 icon or the standard icon) will be displayed based on the specified parameter.

    You can now test this updated code in the wiki environment to see the desired outcome with the correct icon being displayed based on the parameter value.

  7. User

    example write

  8. Assistant

    Here is an example of how you can use the updated switch statement in your wiki code:

    {{doc|docpage=Template:Hl2/doc}}
    <includeonly><onlyinclude>{{#switch: {{{1|}}}
    | bms12 = {{Software
        | ico = Bms icon2012.png
        | ico size = 16px
        | link = Black Mesa (Source)
        | name = {{Autolang
            | Black Mesa
            | zh = 黑山
            }}
        | name2 = {{Autolang
            | Black Mesa 2012
            }}
        | suf = {{{suf|}}}
        | col = #ffffff
        | addtext = {{{addtext|}}}
        | nt = {{{nt|}}}
        }}
    | #default = {{Software
        | ico = Bms icon.png
        | ico size = 16px
        | link = Black Mesa (Source)
        | name = {{Autolang
            | Black Mesa
            | zh = 黑山
            }}
        | name0 = bms
        | name1 = {{Autolang
            | Black Mesa: Source
            | zh = 黑山:起源
            }}
        | name2 = {{Autolang
            | Black Mesa: Definitive Edition
            }}
        | suf = {{{suf|}}}
        | col = #E57126
        | addtext = {{{addtext|}}}
        | nt = {{{nt|}}}
        }}
    }}</onlyinclude></includeonly>
    

    In this example, the switch statement will check the value of the parameter passed in ({{{1|}}}) and display the appropriate software block with the corresponding icon and information. You can now add this code to your wiki page and test it to see the icon displayed based on the parameter value.

  9. User

    i mean, in article {{bms}}

  10. Assistant

    To demonstrate the switch statement in action within an article where you use the {{bms}} template, you can follow these steps:

    1. In your article, insert the {{bms}} template with the parameter for the switch statement. For example:
    {{bms}}
    
    1. In the template {{bms}}, you should replace the original code with the switch statement code provided earlier. This will determine which icon to display based on the parameter passed to the template.

    2. When you save the article with the {{bms}} template, the switch statement will be triggered, and it will display the appropriate icon (standard or 2012) based on the given parameter value.

    Make sure the template {{bms}} or any equivalent template in your wiki project includes the switch statement logic provided earlier. This way, when you add {{bms}} to your article and set the parameter to bms12, the 2012 icon will be displayed; otherwise, the standard icon will be shown.

    If you encounter any issues or need further assistance, feel free to ask for help.

  11. User

    write 2012

  12. Assistant

    If you want to display the 2012 icon in the article, you can directly use the template that corresponds to the 2012 version. Assuming that the template for the 2012 version is {{bms12}}, you can simply add the following code to your article where you want to display the Black Mesa 2012 icon:

    {{bms12}}
    

    Make sure to define the {{bms12}} template with the appropriate icon and information for the Black Mesa 2012 version. This way, when you include {{bms12}} in your article, it will display the 2012 icon as intended.

    If you need further assistance with creating or modifying the {{bms12}} template, feel free to provide more details, and I'll be happy to help.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.