이해도 | 초보자 |
---|---|
게임버전 (JE) | 관련없음 |
게임버전 (BE) | 관련없음 |
스크립트 버전 | 2.8.3 |
주식 스크립트를 실행하는데
A global function named "stock" already exist in script 'stock.sk'
Line: function stock(s: integer , p: player):
라고 뜨네요
스크립트 내용입니다 꼭 고치고 싶어요 ㅠㅠ
options:
주식: &a&l[&e&lStock&a&l]&f
설명: &b&l[&2&lStock Help&b&l]&f
오류: &4&l[&c&l오류&4&l]&f
variables:
{주식변동시간} = 60
function stock(s: integer, p: player):
open chest with 4 rows named "&e&l[주식] &2돈 : %{_p}'s money% &c남은 시간 : %{주식변동시간쿨타임}%" to {_p}
set {_n} to 1
loop {주식.1::*}:
set {_임시주식.1::%{_n}%} to {주식.1::%loop-index%}
set {_임시주식.2::%{_n}%} to {주식.2::%loop-index%}
set {_임시주식.3::%{_n}%} to {주식.3::%loop-index%}
set {_임시주식.4::%{_n}%} to {주식.4::%loop-index%}
set {_임시주식.5::%{_n}%} to {주식.5::%loop-index%}
set {_임시주식갯수::%{_n}%::%uuid of {_p}%} to {주식갯수::%loop-index%::%uuid of {_p}%}
add 1 to {_n}
set {_endglass} to 0
set {_sx} to {_s}
remove 1 from {_sx}
set {_sx} to {_sx} * 27
set {_slot} to 0
loop 27 times:
add 1 to {_sx}
set slot {_slot} of current inventory of {_p} to air
if {_임시주식.1::%{_sx}%} is set:
if {_임시주식.5::%{_sx}%} is true:
set slot {_slot} of current inventory of {_p} to paper named "&f%{_임시주식.1::%{_sx}%}%" with lore "&f보유주식 : %{_임시주식갯수::%{_sx}%::%uuid of {_p}%}%%nl%&f주가 : &c%{_임시주식.2::%{_sx}%}%%nl%&c상승률 &f: %{_임시주식.3::%{_sx}%}%%%%nl%&b하락률 &f: %{_임시주식.4::%{_sx}%}%%%%nl%&f매수 : 좌클릭 │ 매각 : 우클릭"
else if {_임시주식.5::%{_sx}%} is false:
set slot {_slot} of current inventory of {_p} to paper named "&f%{_임시주식.1::%{_sx}%}%" with lore "&f보유주식 : %{_임시주식갯수::%{_sx}%::%uuid of {_p}%}%%nl%&f주가 : &b%{_임시주식.2::%{_sx}%}%%nl%&c상승률 &f: %{_임시주식.3::%{_sx}%}%%%%nl%&b하락률 &f: %{_임시주식.4::%{_sx}%}%%%%nl%&f매수 : 좌클릭 │ 매각 : 우클릭"
else:
set slot {_slot} of current inventory of {_p} to paper named "&f%{_임시주식.1::%{_sx}%}%" with lore "&f보유주식 : %{_임시주식갯수::%{_sx}%::%uuid of {_p}%}%%nl%&f주가 : &f%{_임시주식.2::%{_sx}%}%%nl%&c상승률 &f: %{_임시주식.3::%{_sx}%}%%%%nl%&b하락률 &f: %{_임시주식.4::%{_sx}%}%%%%nl%&f매수 : 좌클릭 │ 매각 : 우클릭"
add 1 to {_slot}
loop 9 times:
set slot {_endglass} + 27 of current inventory of {_p} to dark gray stained glass pane named "&f"
add 1 to {_endglass}
set slot 30 of current inventory of {_p} to red stained glass pane named "&c전 페이지 (%{_s} - 1%)"
set slot 31 of current inventory of {_p} to white stained glass pane named "&b%{_s}%"
set slot 32 of current inventory of {_p} to green stained glass pane named "&2다음 페이지 (%{_s} + 1%)"
play sound "entity_experience_orb_pickup" with volume 100 and pitch 1 for {_p}
command /주식:
trigger:
open chest with 4 rows named "&e&l[주식] &2돈 : %player's money% &c남은 시간 : %{주식변동시간쿨타임}%" to player
stock(1, player)
on inventory click:
if event-inventory's display name contains "&e&l[주식]":
cancel event
on inventory click:
if event-inventory's display name contains "&e&l[주식]":
set {_page} to uncolored name of slot 31 of current inventory
set {_page} to "%{_page}%" parsed as integer
set {_lore::*} to lore of clicked item
if name of event-slot contain "&c전 페이지":
set {_slot} to uncolored name of event-slot
replace all "전" and " " and "페이지" and "(" and ")" with "" in {_slot}
set {_slot} to "%{_slot}%" parsed as integer
if {_slot} > 0:
stock({_slot}, player)
else if name of event-slot contain "&2다음 페이지":
set {_slot} to uncolored name of event-slot
replace all "다음" and " " and "페이지" and "(" and ")" with "" in {_slot}
set {_slot} to "%{_slot}%" parsed as integer
stock({_slot}, player)
else if {_lore::1} contain "&f보유주식":
loop {주식.1::*}:
if name of event-slot is {주식.1::%loop-index%}:
if click type is left mouse button:
if player's money >= {주식.2::%loop-index%}:
remove {주식.2::%loop-index%} from player's money
add 1 to {주식갯수::%loop-index%::%uuid of player%}
message "{@주식} 매수완료" to player
else:
message "{@오류} 돈이 없어 매수할 수 없습니다." to player
if click type is right mouse button:
if {주식갯수::%loop-index%::%uuid of player%} >= 1:
add {주식.2::%loop-index%} to player's money
remove 1 from {주식갯수::%loop-index%::%uuid of player%}
message "{@주식} 매각완료" to player
else:
message "{@오류} 주식이 없어 매각할 수 없습니다." to player
stock({_page}, player)
stop
if uncolored name of event-slot is {주식.1::%loop-index%}:
if click type is left mouse button:
if player's money >= {주식.2::%loop-index%}:
remove {주식.2::%loop-index%} from player's money
add 1 to {주식갯수::%loop-index%::%uuid of player%}
message "{@주식} 매수완료" to player
else:
message "{@오류} 돈이 없어 매수할 수 없습니다." to player
if click type is right mouse button:
if {주식갯수::%loop-index%::%uuid of player%} >= 1:
add {주식.2::%loop-index%} to player's money
remove 1 from {주식갯수::%loop-index%::%uuid of player%}
message "{@주식} 매각완료" to player
else:
message "{@오류} 주식이 없어 매각할 수 없습니다." to player
stock({_page}, player)
stop
else:
stock({_page}, player)
command /주식생성 [<text>] [<integer>] [<integer>] [<integer>]:
trigger:
if player is op:
if arg 1 is not set:
message "{@설명} /주식생성 [주식이름] [주가] [상승률] [하락률]"
else if arg 2 is not set:
message "{@오류} 주가를 입력해주세요."
else if arg 3 is not set:
message "{@오류} 상승률을 입력해주세요"
else if arg 4 is not set:
message "{@오류} 하락률을 입력해주세요"
else:
if {주식.1::%arg 1%} is not set:
set {주식.1::%arg 1%} to colored arg 1
set {주식.2::%arg 1%} to arg 2
set {주식.3::%arg 1%} to arg 3
set {주식.4::%arg 1%} to arg 4
message "{@주식} %colored arg 1%&f주식이 생성되었습니다."
else:
message "{@오류} 해당 주식은 이미 존재하므로 만들 수 없습니다."
command /주식삭제 [<text>]:
trigger:
if player is op:
if arg 1 is not set:
message "{@설명} /주식삭제 [주식이름]"
else:
delete {주식.1::%arg 1%}
delete {주식.2::%arg 1%}
delete {주식.3::%arg 1%}
delete {주식.4::%arg 1%}
delete {주식갯수::%arg 1%::*}
message "{@주식} %colored arg 1% &f주식이 삭제되었습니다."
command /주식삭제전체:
trigger:
if player is op:
delete {주식.1::*}
delete {주식.2::*}
delete {주식.3::*}
delete {주식.4::*}
delete {주식갯수::*}
message "{@주식} 모든 주식이 삭제되었습니다."
command /주식변동시간 [<integer>]:
trigger:
if player is op:
set {주식변동시간} to arg 1
message "{@주식} 주식변동 쿨타임이 %arg 1%초로 설정되었습니다."
every 1 seconds:
if {주식변동시간쿨타임} <= 0:
loop {주식.1::*}:
chance of 50%:
set {_변동률.%loop-index%} to random integer between 0 and {주식.3::%loop-index%}
set {_변동률.%loop-index%} to {_변동률.%loop-index%}/100
set {주식.2::%loop-index%} to {주식.2::%loop-index%} + {주식.2::%loop-index%}*{_변동률.%loop-index%}
set {주식.2::%loop-index%} to round {주식.2::%loop-index%}
set {주식.5::%loop-index%} to true
else:
set {_변동률.%loop-index%} to random integer between 0 and {주식.4::%loop-index%}
set {_변동률.%loop-index%} to {_변동률.%loop-index%}/100
set {주식.2::%loop-index%} to {주식.2::%loop-index%} - {주식.2::%loop-index%}*{_변동률.%loop-index%}
set {주식.2::%loop-index%} to round {주식.2::%loop-index%}
set {주식.5::%loop-index%} to false
set {주식변동시간쿨타임} to {주식변동시간}
else:
remove 1 from {주식변동시간쿨타임}
코코냐
2024.03.21오류 내용은 읽어보셨냐요?
Jonas0723
2024.03.21네 펑션이 잘못되었다고 나와있어요
세찐찐
2024.03.21stock이라는 함수는 이미 존재하여서 또 stock을 정의할수 없습니다
다른 stock함수가 정의된 코드를 삭제하거나 함수명을 수정하세요