VX 스크립트

TagNote
Provides a means for pulling tag/value pairs out the notes field for anything. This enables simple storage of extra parameters for other scripts in a way that won't work at cross-purposes with itself or other uses for the notes field.

Note that you will probably need to put this script before any others that use it.

In any notes field, you can write: <tag_name tag_value> to store tag_value under the name tag_name. You can also store nothing, if no value is needed, through <tag_name> in the notes field. This slightly updated version supports additional parameters in the tag name.

Download: http://chthonic.150m.com/scratch/Queex_scripts.zip
여기서부터
###############
# TagNote #
######################################################################
# Version 2.0 #
# Author: Queex #
# Licence: Creative Commons non-commercial attributive #
######################################################################
# Allows the easy use of tags in the note field for #
# objects to store data. Syntax is simple, and the system ignores #
# any lines in the notes field that don't match the syntax. #
# #
# Version history: #
# 1.2 Final 1.x version #
# 2.0 Changed to follow Ruby naming conventions #
# #
# Usage: #
# get_tag(<notes field>,<tag name>) #
# has_tag?(<notes field>,<tag name>) #
# has_tag_value?(<notes field>,<tag name>,<tag value>) #
# get_additional_tag(<notes field>,<tag name>,<index> #
# get_additional_tag_by_value(<notes field>,<tag name>,<tag value> #
# ,<index> #
# #
# Syntax in the note field: #
# <tag_name tag_value> #
# <tag_name> #
# <tag_name tag_value param1 param2 ...> #
######################################################################

module TAGNOTE

###########
# get_tag #
###################################################################
# Gets the stored value of the first occurrence of the named tag #
# in the notes field. #
# <tag_name tag_value tag_value2> will return 'tag_value' #
# <tag_name tag_value> will return 'tag_value' #
# <tag_name> will return true #
# if no tag with tag_name, returns nil #
###################################################################
def get_tag(note_field, tag_name)
lines=note_field.split("n")
for line in lines
#process line by line
if line[0,1].eql?("<")
#this line has a tag
line2=line.split(/[<> ]/)
if line2[1].eql?(tag_name)
if(line2.length==2)
#there is actually no value
return true
else
return line2[2]
end
end
end
end
return nil
end

############
# has_tag? #
##################################################################
# Indicates whether the given note field has a tag of that name. #
# <tag_name tag_value tag_value2> and #
# <tag_name tag_value> and #
# <tag_name> will both return true #
# if no tag with tag_name, returns false #
##################################################################
def has_tag?(note_field,tag_name)
lines=note_field.split("n")
for line in lines
if line[0,1].eql?("<")
line2=line.split(/[<> ]/)
if line2[1].eql?(tag_name)
return true
end
end
end
return false
end

##################
# has_tag_value? #
#################################################################
# Indicates whether the note field has a tag of a given name #
# with a certain value. #
# <tag_name tag_value> returns true #
# <tag_name wrong_tag_value> returns false #
# <tag_name> returns false #
# if no tag with tag_name has the correct value, returns false. #
# tag_value2 is ignored #
#################################################################
def has_tag_value?(note_field,tag_name,tag_value)
lines=note_field.split("n")
for line in lines
if line[0,1].eql?("<")
line2=line.split(/[<> ]/)
if line2[1].eql?(tag_name) and line2[2].eql?(tag_value)
return true
end
end
end
return false
end

######################
# get_additional_tag #
######################################################################
# Gets additional parameters for a tag of a given name. #
# Calling with an index of 1 returns #
# the first value after the tag name. #
# Returns nil if the index is higher than the last parameter. #
# Returns false if no match for the tag name is found. #
######################################################################
def get_additional_tag(note_field,tag_name,index)
lines=note_field.split("n")
for line in lines
if line[0,1].eql?("<")
line2=line.split(/[<> ]/)
if line2[1].eql?(tag_name)
if(line2.length<index+2)
#Actually no value to get
return nil
else
return line2[index+1]
end
end
end
end
return false
end

###############################
# get_additional_tag_by_value #
######################################################################
# Gets additional parameters for a tag of a given name #
# with a certain value. Calling with an index of 1 returns #
# the first value after the tag name. #
# Returns nil if the index is higher than the last parameter. #
# Returns false if no match for the tag name and tag value is found. #
######################################################################
def get_additional_tag_by_value(note_field,tag_name,tag_value,index)
lines=note_field.split("n")
for line in lines
if line[0,1].eql?("<")
line2=line.split(/[<> ]/)
if line2[1].eql?(tag_name) and line2[2].eql?(tag_value)
if(line2.length<index+2)
#Actually no value to get
return nil
else
return line2[index+1]
end
end
end
end
return false
end

end
Comment '5'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
117 전투 RPG tankentai에서의 치명적 문제점을 보완한 스크립트 2 file 톰소여동생 2010.11.03 3117
116 스킬 Simple Sort Inventory 1.3a by cozziekuns 5 file Alkaid 2010.11.10 1636
115 스킬 Simple Sort Skill Inventory 1.1 by cozziekuns 5 file Alkaid 2010.11.10 2350
114 아이템 아이템 무게, 아이템별 소지수 적용 16 file 허걱 2010.11.11 2981
113 기타 RMVX Patcher 1.2.0 by Yeyinde 5 file Alkaid 2010.11.12 2118
112 기타 HG_SHOOT_ANIMATION 4 file 허걱 2010.11.17 2596
111 변수/스위치 HG_SelfVariables 셀프 변수 8 file 허걱 2010.11.19 2341
110 전투 사이드 뷰 시스템 [시트르산님 제공] 56 아방스 2010.11.29 7499
109 미니맵 MiniMap 1.0 미니맵 스크립트. 39 아방스 2010.12.02 4740
108 스킬 체스트 팝업 3.0 9 file 파이어 2010.12.05 3037
107 장비 장비 레벨 개념 추가 스크립트 14 아방스 2010.12.06 3275
106 이동 및 탈것 3D 던젼 스크립트 38 아방스 2010.12.06 5772
105 전투 전투후 HP/MP 퍼센테이지(지정) 회복 5 하얀슬픔 2010.12.06 2490
104 HUD HUD 스크립트 모음 10 아방스 2010.12.11 3658
103 메뉴 기본메인 메뉴 아이콘 추가 10 아방스 2010.12.11 4573
102 전투 GTBS 1.5.1.4 - GubiD's Tactical Battle System 10 아방스 2010.12.11 4451
101 HUD KH HUD (HP MP 게이지바 스크립트) 41 아방스 2010.12.17 6422
100 메시지 캐릭터 대화상자 - Character's Textbox ver 1.0 6 아방스 2010.12.17 6455
99 상태/속성 MOG - Menu Status V 2.0 16 아방스 2011.01.01 3316
98 메시지 소설풍(노벨풍) 문자 스크립트 31 file 맛난호빵 2011.01.03 5551
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32