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
130 기타 게임 해상도를 조절 하는 스크립트 19 아방스 2008.01.21 4780
129 기타 VX에서 포그 그래픽을 사용하자 16 아방스 2008.01.31 3895
128 기타 텍스트 파일 읽어 오는 스크립트 11 아방스 2008.03.04 2877
127 기타 간단한 스크립트의 사용법 6 아방스 2008.03.09 4552
126 기타 rpg vx 렉 줄이는 스크립트 34 아방스 2008.03.09 4813
125 기타 2 Players Engine 11 레이니케 2008.03.28 2294
124 기타 [VX] Anti-Lag 1.2c by Anaryu[예제첨부] 3 file WMN 2008.04.06 2371
123 기타 빛 이펙트 71 file DEVIL<Li Patanis Roni Kraudus> 2008.06.06 5860
122 기타 [KGC]한계돌파 9 방콕족의생활 2008.06.13 3599
121 기타 RPG 2000이나 RPG 2003처럼 전체화면으로 나오게 하는 스크립트(대박) 21 Man... 2008.10.28 4821
» 기타 TagNote v2.0 5 Man... 2008.10.28 1996
119 기타 Crissaegrim Farm BETA 1.0.0 10 Man... 2008.11.22 3093
118 기타 디스크 체인져 VX!! (업데이트..) 30 file Tofuman 2008.12.02 3168
117 기타 이벤트 위치 저장 스크립트 10 Tofuman 2008.12.11 2096
116 기타 책 읽기 스크립트. 19 허걱 2009.01.31 4490
115 기타 Staff Roll 13 file 허걱 2009.01.31 3523
114 기타 VX서비스팩1 6 훈덕 2009.02.03 2806
113 기타 작은 게이지바 표시 스크립트 44 file 허걱 2009.02.05 5979
112 기타 Base Project 15 아방스 2009.02.05 3063
111 기타 라이트 이펙트 스크립트 12 file 아방스 2009.02.07 3262
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7