질문과 답변

Extra Form

안녕하세요... 모르는게 있어 질문드립니다....

 

 

 

 

기본 변수 메소드 - $gameVariables.setValue(value,n)

셀프 변수 플러그인 - this.get_self_variable(name,n)

 

 

 

 

질문드리는 식은 아래 초록색 식입니다.

 

for (var i = 0; i < 100; i++) {

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", i))

}

 

 

 

 

이렇게 썻는데 실행하면 작동은 되는데 게임상에서는

 

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 1))

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 2))

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 3))

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 99))

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 100))

 

이렇게 표시나요?

 

 

 

 

 

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 1~100))

아니면, 빨간색갈 부분의 숫자만 바뀌나요 ..................?

 

 

 

 

-----------------------------------------------------

 

 

 

 

 

$gameVariables.setValue(146, 이곳에)

 

위의 식의 '이곳에'라는 곳에 아래의 식을 다 더해서 넣어주고 싶습니다...

물론, 노가다로 1부터 100까지 직접 작성하는 방법이 있지만,

for문이나 어떠한 요약식으로 요약하여 1~100을 쉽게 더하는 방법이 있는지 질문드립니다... ㅠㅠ

 

this.get_self_variable("병렬처리대상", 1)

this.get_self_variable("병렬처리대상", 2)

this.get_self_variable("병렬처리대상", 3)

.

.

.

this.get_self_variable("병렬처리대상", 99)

this.get_self_variable("병렬처리대상", 100)

 

어떻게 써야 1~100까지 위의 문장을 반복해서 더해줄 수가 있을까요?

 

$gameVariables.setValue(146, this.get_self_variable("병렬처리대상", 1) + .................... + this.get_self_variable("병렬처리대상", 100))

 

이런 느낌입니다...

 

도와주세요 ㅠㅠ

Comment '1'
  • ?
    일단 2016.12.18 17:27
    굵은 글씨로 요청하신 부분 해결책은 아래와 같습니다.

    var sum = 0; // 혹시 문자열들의 합이라면, var sum = ""; 라고 해주시면 될 듯.
    for (var i = 0; i < 100; i++) {
    sum += this.get_self_variable("병렬처리대상", i))
    }
    $gameVariables.setValue(146, sum);

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12442
Board Pagination Prev 1 ... 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 Next
/ 83