Creative+ Marketplace/"Auction house" (Guide)

sprinkler

Member
Joined
May 19, 2023
Messages
44
Set an initial value of "Slot" (SAVED) Variable to -1

chat event -> if contains @mp sell and if player not holding air call function "Sell" (1)

Function Sell (1): If Slot variable not equals 54, split player message into elements, get element from third index of the split (which is the price) , if element does NOT contain alphabets [ All characters from a to z] and if element is more than 0 and less than 9999999, Increase Slot by 1 -> set variable %player% item to Current Item.
Set variable combine text %player% combine 1 to "Name : %default%" and set variable combine text %player% combine 2 to "Price : [variable used to save output of third index]. Set variable %player% item edited to current item. Set variable Add item description, save output variable as %player% item edited, Put "%player% item edited" on the Item slot as well and on the text slot place %player% combine 1 variable. Then place another set variable add item description, place the "%player% item edited" on the output and item slot and %player% combine 2 in the text slot. Game action set container item place the chest location in location slot. %player% item edited in the item variable slot and Slot variable in the place where you put the slot number. Followed by placing four append element block. First append put "Items" array (Saved) and place %player% item variable to value. Second append place "Owner" array (SAVED) and set value to current name. Third append place "Price" array (SAVED) and set value to the third element we retrieved earlier from split text. Fourth append place "EditedItems" (SAVED) and set value to "%player% item edited" and place player action set item in hand (main hand) [ leave slot empty].

Player Event click inventory. Player if inventory name equals "MarketPlace". If player item NOT equals (Chest empty) [Prevents people from clicking empty slots]. Place set variable addition. Save the value of Clicked Slot + 1 to %player% temp [ Syncs the clicked slot and array index] [ Arrays starts at 1, chest slot starts at 0, hence the increment]. Get array element from "EditedItems", index as %player% temp, output as %player% check inv. If variable %player% check inv == Clicked slot. [ Explanation: While having the MarketPlace chest open, a player can click on HIS OWN inventory and that still will run the code, This check prevents it by checking if the clicked item is equal to the item in the array]. Get element Array name : "Owner", index as %player% temp and output as %player% check owner. If variable %player% check owner NOT EQUALS to Current name/default. Call function Buy (2) [ Dont forget to add cancel event at if inv name equals MarketPlace -> cancel.

Function Buy (2): Get element Array: "Price", index as %player% temp, output as %player% asking price. If variable %player% money (SAVED) more/equal to %player% asking price. Decrement %player% money by %player% asking price. Get element Array "Items", index as %player% temp , output as %player% buying item. Player action close inventory. Player action give variable ( %player% buying item). Game action Set container (Location : MarketPlace chest ). Slot as clicked slot. Spawn entity (Villager , loc at a hidden place, name as %player% check owner). Select object entities by condition by name equals %player% check owner. Increment %selected% money by %default% asking price. Player action Delete entity (SELECTION) . Select object default player. Four delete array blocks. Fill the chest with arrays: Item, Price, Owner, Edited Items and set the index to be %default% temp. Decrement Slot var by 1. Call Function: Refresher (3)

Function Refresher (3): Get length of array, array: Price, output var: array.len. Set variable slot.clicked to 0. Set var array.index to 1. Empty container (loc:MarketPlace chest). Call function RefreshLoop (4)

Function RefreshLoop (4): If variable compare array.index less/equal than array.len. Get element from array:EditedItems, index as array.index, output:var temp. Set container item, Item variable : var temp, location: Chest, slot: var slot.clicked. Increment slot.clicked by 1. Increment array.index by 1. Wait 0.5 tick. Call function RefreshLoop (4)

This is just a base code. I believe the code fully works, if it doesnt, likely due to any error while typing here. THIS IS NOT AN AUCTION. All arrays except Split message one , are SAVED. the global var "Slot" IS ALSO SAVED

Just a heads up, if your world contains other fast loops, it's better to increase the wait from 0.5 to 1 tick. if the chest is full, it will take just about 3 seconds to fully refresh (at 1 tick). You may add a condition to check If variable updating Not equals true-> open inv on the @mp view cmd.

Edit:
Credits to veddnt too for helping me out
 
Last edited:

veddnt

Active member
Joined
Jun 2, 2023
Messages
201
this bozo literally read my thread about EI then he acts like he knows more about it than I do
oK ok what the actual??? I never said ik more than or less than you 🙄🙄 stupid numbnut and whats with reading your old forum post?? Fyfi: i'm also a coder 😤
 

veddnt

Active member
Joined
Jun 2, 2023
Messages
201
Set an initial value of "Slot" (SAVED) Variable to -1

chat event -> if contains @mp sell and if player not holding air call function "Sell" (1)

Function Sell (1): If Slot variable not equals 54, split player message into elements, get element from third index of the split (which is the price) , if element does NOT contain alphabets [ All characters from a to z] and if element is more than 0 and less than 9999999, Increase Slot by 1 -> set variable %player% item to Current Item.
Set variable combine text %player% combine 1 to "Name : %default%" and set variable combine text %player% combine 2 to "Price : [variable used to save output of third index]. Set variable %player% item edited to current item. Set variable Add item description, save output variable as %player% item edited, Put "%player% item edited" on the Item slot as well and on the text slot place %player% combine 1 variable. Then place another set variable add item description, place the "%player% item edited" on the output and item slot and %player% combine 2 in the text slot. Game action set container item place the chest location in location slot. %player% item edited in the item variable slot and Slot variable in the place where you put the slot number. Followed by placing four append element block. First append put "Items" array (Saved) and place %player% item variable to value. Second append place "Owner" array (SAVED) and set value to current name. Third append place "Price" array (SAVED) and set value to the third element we retrieved earlier from split text. Fourth append place "EditedItems" (SAVED) and set value to "%player% item edited" and place player action set item in hand (main hand) [ leave slot empty].

Player Event click inventory. Player if inventory name equals "MarketPlace". If player item NOT equals (Chest empty) [Prevents people from clicking empty slots]. Place set variable addition. Save the value of Clicked Slot + 1 to %player% temp [ Syncs the clicked slot and array index] [ Arrays starts at 1, chest slot starts at 0, hence the increment]. Get array element from "EditedItems", index as %player% temp, output as %player% check inv. If variable %player% check inv == Clicked slot. [ Explanation: While having the MarketPlace chest open, a player can click on HIS OWN inventory and that still will run the code, This check prevents it by checking if the clicked item is equal to the item in the array]. Get element Array name : "Owner", index as %player% temp and output as %player% check owner. If variable %player% check owner NOT EQUALS to Current name/default. Call function Buy (2) [ Dont forget to add cancel event at if inv name equals MarketPlace -> cancel.

Function Buy (2): Get element Array: "Price", index as %player% temp, output as %player% asking price. If variable %player% money (SAVED) more/equal to %player% asking price. Decrement %player% money by %player% asking price. Get element Array "Items", index as %player% temp , output as %player% buying item. Player action close inventory. Player action give variable ( %player% buying item). Game action Set container (Location : MarketPlace chest ). Slot as clicked slot. Spawn entity (Villager , loc at a hidden place, name as %player% check owner). Select object entities by condition by name equals %player% check owner. Increment %selected% money by %default% asking price. Player action Delete entity (SELECTION) . Select object default player. Four delete array blocks. Fill the chest with arrays: Item, Price, Owner, Edited Items and set the index to be %default% temp. Decrement Slot var by 1. Call Function: Refresher (3)

Function Refresher (3): Get length of array, array: Price, output var: array.len. Set variable slot.clicked to 0. Set var array.index to 1. Empty container (loc:MarketPlace chest). Call function RefreshLoop (4)

Function RefreshLoop (4): If variable compare array.index less/equal than array.len. Get element from array:EditedItems, index as array.index, output:var temp. Set container item, Item variable : var temp, location: Chest, slot: var slot.clicked. Increment slot.clicked by 1. Increment array.index by 1. Wait 0.5 tick. Call function RefreshLoop (4)

This is just a base code. I believe the code fully works, if it doesnt, likely due to any error while typing here. THIS IS NOT AN AUCTION. All arrays except Split message one , are SAVED. the global var "Slot" IS ALSO SAVED
No credits 😔
 

deefer

Active member
Joined
May 22, 2023
Messages
458
oK ok what the actual??? I never said ik more than or less than you 🙄🙄 stupid numbnut and whats with reading your old forum post?? Fyfi: i'm also a coder 😤
u said "yes". did i ask a question? did i ask whether the code is possible or not?
 

deefer

Active member
Joined
May 22, 2023
Messages
458
theres nothing wrong with reading my old forum post except if u stole the idea of mine and u started expanding the view point of it without giving credits
 

deefer

Active member
Joined
May 22, 2023
Messages
458
im dumb? huh this bozo literally asked his homework online inside The Lab what a Looser
 

deefer

Active member
Joined
May 22, 2023
Messages
458
veddnt if u think u can defeat me with that attitude then ok? i accept the defeat OF U
 

Hayden

Member
Joined
May 19, 2023
Messages
34
Set an initial value of "Slot" (SAVED) Variable to -1

chat event -> if contains @mp sell and if player not holding air call function "Sell" (1)

Function Sell (1): If Slot variable not equals 54, split player message into elements, get element from third index of the split (which is the price) , if element does NOT contain alphabets [ All characters from a to z] and if element is more than 0 and less than 9999999, Increase Slot by 1 -> set variable %player% item to Current Item.
Set variable combine text %player% combine 1 to "Name : %default%" and set variable combine text %player% combine 2 to "Price : [variable used to save output of third index]. Set variable %player% item edited to current item. Set variable Add item description, save output variable as %player% item edited, Put "%player% item edited" on the Item slot as well and on the text slot place %player% combine 1 variable. Then place another set variable add item description, place the "%player% item edited" on the output and item slot and %player% combine 2 in the text slot. Game action set container item place the chest location in location slot. %player% item edited in the item variable slot and Slot variable in the place where you put the slot number. Followed by placing four append element block. First append put "Items" array (Saved) and place %player% item variable to value. Second append place "Owner" array (SAVED) and set value to current name. Third append place "Price" array (SAVED) and set value to the third element we retrieved earlier from split text. Fourth append place "EditedItems" (SAVED) and set value to "%player% item edited" and place player action set item in hand (main hand) [ leave slot empty].

Player Event click inventory. Player if inventory name equals "MarketPlace". If player item NOT equals (Chest empty) [Prevents people from clicking empty slots]. Place set variable addition. Save the value of Clicked Slot + 1 to %player% temp [ Syncs the clicked slot and array index] [ Arrays starts at 1, chest slot starts at 0, hence the increment]. Get array element from "EditedItems", index as %player% temp, output as %player% check inv. If variable %player% check inv == Clicked slot. [ Explanation: While having the MarketPlace chest open, a player can click on HIS OWN inventory and that still will run the code, This check prevents it by checking if the clicked item is equal to the item in the array]. Get element Array name : "Owner", index as %player% temp and output as %player% check owner. If variable %player% check owner NOT EQUALS to Current name/default. Call function Buy (2) [ Dont forget to add cancel event at if inv name equals MarketPlace -> cancel.

Function Buy (2): Get element Array: "Price", index as %player% temp, output as %player% asking price. If variable %player% money (SAVED) more/equal to %player% asking price. Decrement %player% money by %player% asking price. Get element Array "Items", index as %player% temp , output as %player% buying item. Player action close inventory. Player action give variable ( %player% buying item). Game action Set container (Location : MarketPlace chest ). Slot as clicked slot. Spawn entity (Villager , loc at a hidden place, name as %player% check owner). Select object entities by condition by name equals %player% check owner. Increment %selected% money by %default% asking price. Player action Delete entity (SELECTION) . Select object default player. Four delete array blocks. Fill the chest with arrays: Item, Price, Owner, Edited Items and set the index to be %default% temp. Decrement Slot var by 1. Call Function: Refresher (3)

Function Refresher (3): Get length of array, array: Price, output var: array.len. Set variable slot.clicked to 0. Set var array.index to 1. Empty container (loc:MarketPlace chest). Call function RefreshLoop (4)

Function RefreshLoop (4): If variable compare array.index less/equal than array.len. Get element from array:EditedItems, index as array.index, output:var temp. Set container item, Item variable : var temp, location: Chest, slot: var slot.clicked. Increment slot.clicked by 1. Increment array.index by 1. Wait 0.5 tick. Call function RefreshLoop (4)

This is just a base code. I believe the code fully works, if it doesnt, likely due to any error while typing here. THIS IS NOT AN AUCTION. All arrays except Split message one , are SAVED. the global var "Slot" IS ALSO SAVED

Just a heads up, if your world contains other fast loops, it's better to increase the wait from 0.5 to 1 tick. if the chest is full, it will take just about 3 seconds to fully refresh (at 1 tick). You may add a condition to check If variable updating Not equals true-> open inv on the @mp view cmd.

Edit:
Credits to veddnt too for helping me out
mid just code chat based with a queue
 
Top