CC BY-NC-SA 4.0 국제 라이선스 적용


이 저작물은 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 4.0 국제 라이선스에 따라 이용할 수 있습니다.


이 저작물은 아카라이브 커뮤니티 - AI 채팅 채널을 위해 공개되었으며, AI 채팅 채널 외 타 채널 혹은 커뮤니티에 공유, 배포 등으로 이용할 때에는 반드시 원 저작자의 이름과 출처를 명시해야 합니다. 상업적 용도의 경우 어떠한 이유로도 이용할 수 없습니다.


리믹스, 변형, 2차적 저작물을 작성하고 그 결과물을 공유할 경우에는 원 저작물과 동일한 조건의 CCL을 적용하여야 합니다.



본 제작자는 이 게시물을 포함한 모든 게시물의 상업적 사용을 원하지 않으며, 동의하지 않습니다.


뭔가 묻힐 것 같은 타이밍이지만 일단 만든 거 올려봄



1. ai에게 생성을 맡긴다




2. 생성된 답변은 정규식에 의해 변수를 자동으로 변화시키게 된다. 여기서 인벤토리 열기를 # Inventory #로 일단 대충 지정해놨으니 열어 보자.




잘 열린다.


이제 아이템 추가를 시험해 보자.



출력문 수정했던 걸 그냥 입력문 수정으로 바꿔 놨다

ai가 대충 - Vehicle: 1 x good car 이런 식으로 출력하면 알아서 아이템 획득이 되겠지만 귀찮으니 유저 입력으로 실험하겠다


1. 현재 있는 아이템을 입력하면?

개수만 늘어나고 항목은 그대로


2. 현재 없는 아이템을 입력하면?

새로운 항목 생성


사용 정규식:

Item get (출력문 변경 - 아이템 획득 용도)

인풋: (?<=\- (.*):) ((.*) x (.*))

아웃풋: {{#each {{split::$2::, }} a}} {{#if {{contains::{{getvar::$1}}::{{array_element::{{split::{{slot::a}}:: x }}::1}}}}}} {{setvar::{{array_element::{{split::{{slot::a}}:: x }}::1}}::{{? {{getvar::{{array_element::{{split::{{slot::a}}:: x }}::1}}}}+{{array_element::{{split::{{slot::a}}:: x }}::0}}}}}} {{/if}} {{#if {{? !({{contains::{{getvar::$1}}::{{array_element::{{split::{{slot::a}}:: x }}::1}}}})}}}} {{setvar::{{array_element::{{split::{{slot::a}}:: x }}::1}}::{{array_element::{{split::{{slot::a}}:: x }}::0}}}} {{setvar::$1::{{array_push::{{getvar::$1}}::{{array_element::{{split::{{slot::a}}:: x }}::1}}}}}} {{/if}} {{/each}}


Inventory open (디스플레이 변경 - 아이템 인터페이스 여는 용도)

인풋: # Inventory #

아웃풋: <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Item Inventory</title>     <style>         body {             font-family: Arial, sans-serif;             display: flex;             justify-content: center;             align-items: center;             height: 100vh;             margin: 0;             background: linear-gradient(135deg, #f5f5f5, #eaeaea);         }         .inventory {             display: grid;             grid-template-columns: repeat(3, 1fr);             gap: 20px;             max-width: 80%;             margin: auto;         }         .item {             background: linear-gradient(135deg, #ffffff, #f9f9f9);             border: 1px solid #ddd;             border-radius: 8px;             padding: 20px;             box-shadow: 0 4px 8px rgba(0,0,0,0.1);             text-align: center;             transition: transform 0.2s, box-shadow 0.2s;         }         .item:hover {             transform: translateY(-10px);             box-shadow: 0 8px 16px rgba(0,0,0,0.2);         }         .item h2 {             font-size: 1.5em;             margin-bottom: 10px;             color: #333;         }         .item p {             margin: 10px 0;             color: #666;         }         .item .count {             font-weight: bold;             color: #333;         }     </style> </head> <body>     <div class="inventory"> {{#each {{getvar::Vehicle}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Vehicle</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Ranged Weapon}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Ranged Weapon</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Melee Weapon}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Melee Weapon</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Explosive}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Explosive</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Armor}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Armor</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Ammunition}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Ammunition</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Consumable}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Consumable</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}} {{#each {{getvar::Quest item}} a}} {{#if {{not_equal::{{slot::a}}::null}}}}         <div class="item">             <h2>{{slot::a}}</h2>             <p>Quest item</p>             <p class="count">{{getvar::{{slot::a}}}}</p>         </div> {{/if}} {{/each}}     </div> </body> </html>