Bethesda Tutorial Papyrus Variables and Conditionals/ko

From the CreationKit Wiki
Revision as of 02:03, 5 May 2016 by imported>Weakbeginner
Jump to navigation Jump to search
Bethesda Tutorial Papyrus Variables and Conditionals/ko
Scripting Series, Chapter 2
Return to Tutorial Hub
LeftArrow.png Previous Tutorial Next TutorialRightArrow.png

개요

이 튜토리얼은 당신이 Hello World 튜토리얼을 완수했다고 가정한다.

이번 튜토리얼에서는 :

  • 변수를 만들고 사용하는 방법
  • 나중 작업을 위해 스크립트에 메모를 남기는 방법
  • 게임 내에서 스크립트를 변수 값에 대해 작동시키는 방법
  • 상황에 따른 if-then-else 명령어를 스크립트에 추가하고 사용하는 방법

을 배울 것이다.

변수(Variables)

변수는 어떠한 정보나 대상의 저장공간으로 볼 수 있다. 당신은 변수값들을 설정할 수 있으며, 수치적으로 값을 증가 혹은 감소 시킬 수 있고, 후에 그 내용들을 다시 불러올 수 있다.

이번에는 플레이어가 활성화 횟수를 카운트 하여 그 변수를 Hello World 튜토리얼에서 우리가 썼던 스크립트에 추가할 것이다. 그리고 매번 다른 값이 나오게 할 것이다.

기둥의 Reference창을 다시 열고, HelloWorldScript를 우클릭한다. "Edit Source"를 선택하여 스크립트 편집 창을 띄운다.

당신의 스크립트는 다음과 같이 나올 것이다. :

 Scriptname HelloWorldScript extends ObjectReference  
 {This is my very first script!}

 Event OnActivate(ObjectReference akActionRef)
    Debug.MessageBox("Hello, World!")
 endEvent

이제 변수를 추가해보자. 아래 문장을 "Event OnActivate" 문장의 상단에 추가한다.

 int count  ;stores the number of times this object has been activated
  • int count ;stores the number... - int 는 변수의 타입을 정의한다. 여기서 "Integer"는 소수점이 없는 양,음수의 정수이다.
  • int count ;stores the number... - count는 우리가 변수에 부여한 이름이다. 나중에 다시 쓰게 될 것이다.
  • int count ;stores the number... - 세미콜론(;) 뒤에 있는 문장들은 코멘트의 역할을 한다. 즉, 스크립트 자체가 영향을 받는 것은 아니지만, 누군가가 당신의 스크립트를 보았을 때 이해를 돕는다.

숫자를 세는 문장을 추가해보자. "Event OnActivate..." 문장과 "Debug.MessageBox..." 문장 사이에 다음을 추가한다.

 count = count + 1





Language: English  • français • 日本語 • 한국어 • polski • русский