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 5408
30 기타 ひきも記 RMVX 샘플 프로젝트 9 file Alkaid 2010.09.15 2338
29 기타 Drop Options 1.1 by Modern Algebra 4 Alkaid 2010.09.16 1509
28 기타 집안의 가구를 내마음대로 데코레이션하기 15 file EuclidE 2010.09.18 4303
27 기타 Wora's Christmas Giftbox 2008 4 file Alkaid 2010.09.18 1747
26 기타 ActivateEvents 8 file EuclidE 2010.09.18 1692
25 기타 OriginalWij's Script Compilation 1.2 2 Alkaid 2010.09.20 1583
24 기타 책 읽기 스크립트 44 file 히류 2010.10.05 4506
23 기타 Modified Advanced Weather Script VX 1.1 3 file Alkaid 2010.10.08 1967
22 기타 RMVX Patcher 1.2.0 by Yeyinde 5 file Alkaid 2010.11.12 2118
21 기타 HG_SHOOT_ANIMATION 4 file 허걱 2010.11.17 2596
20 기타 IEX - Script Library 1.0 by IceDragon 8 Alkaid 2011.01.11 2619
19 기타 KGC counter 스크립트. 반격기 추가스크립트입니다. 4 우켈킁 2011.03.31 1812
18 기타 해상도 변경 스크립트 11 카리스 2011.07.19 2723
17 기타 화면 확대 스크립트 12 file 에돌이 2011.07.22 3061
16 기타 요리 시스템을 도입하는 스크립트입니다. 9 file 스페나로츠 2011.08.18 3145
15 기타 여러스크립트(목적은 포인트) 12 file 인생은 힘들다. 2011.08.26 3088
14 기타 [XP / VX 공용] rand() 함수 확장 스크립트 4 허걱 2011.09.13 2363
13 기타 Kylock1.2+(RMDude-Kylock1.5) Time System Script 4 file communnn 2011.10.20 2595
12 기타 아이디를 띄우기 20 12345678 2011.11.07 4627
11 기타 화면 해상도(640 X 480) 스크립트 6 file 쿠쿠밥솥 2012.01.10 3972
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7