Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Sony's QuadShop Controller
- @inputs [EGP]:wirelink [User]:entity RangerTL RangerTR RangerBL RangerBR
- @outputs ShipmentUserTL ShipmentUserTR ShipmentUserBL ShipmentUserBR
- @persist SelectedOption
- @trigger
- # Sony's QuadShop Controller
- # Made by Sony - https://steamcommunity.com/id/Sony_08/
- # Feel free to drop me a message if you have any problems.
- # --== QuadShop Config: ==-- #
- CurrencySymbol = "£" # What currency symbol do we display?
- GunNameTL = "Keypad Cracker" # What gun are we selling? (String)
- GunPriceTL = 250 # For what price? (Number)
- GunNameTR = "Lockpick" # What gun are we selling? (String)
- GunPriceTR = 100 # For what price? (Number)
- GunNameBL = "Holoscanner" # What gun are we selling? (String)
- GunPriceBL = 500 # For what price? (Number)
- GunNameBR = "Knife" # What gun are we selling? (String)
- GunPriceBR = 100 # For what price? (Number)
- # By default this uses some sounds from TF2 because they sound better IMO.
- # For those that don't want to use TF2 content, just change these vars to use HL2 sounds instead.
- Sound_Purchase = "mvm/mvm_bought_upgrade.wav" # What sound plays when someone buys something? (string)
- Sound_Failed = "mvm/mvm_money_vanish.wav" # What sound plays when there is a problem. (string)
- # --== End of config, don't edit below here unless you know what you're doing. ==-- #
- if(first() || dupefinished())
- {
- function void prefixPrint(Text:string)
- {
- printColor(vec(100, 100, 255), format("\n[%s]", "QuadShop"), vec(180), " : ", Text)
- }
- # Keep a track of which shipment they're trying to buy so we can trigger the right user later.
- SelectedOption = 1
- function void wirelink:mainScreen()
- {
- ShipmentUserTL = 0
- ShipmentUserTR = 0
- ShipmentUserBL = 0
- ShipmentUserBR = 0
- This:egpClear()
- This:egpText(1, "Press to buy", vec2(256, 40))
- This:egpAlign(1, 1, 1)
- This:egpSize(1, 90)
- # Top-Left shipment
- if(GunNameTL != ""&&GunPriceTL != 0){
- This:egpBox(2,vec2(5,130),vec2(10,10))
- This:egpSize(2,vec2(1000,60))
- This:egpColor(2, vec(25))
- This:egpText(3,GunNameTL + " : " + CurrencySymbol + toString(GunPriceTL),vec2(50,115))
- This:egpSize(3,30)
- This:egpColor(3,vec(240,240,240))
- }
- # Top-Right shipment
- if(GunNameTR != ""&&GunPriceTR != 0){
- This:egpBox(4,vec2(5,200),vec2(10,10))
- This:egpSize(4,vec2(1000,60))
- This:egpColor(4, vec(25))
- This:egpText(5,GunNameTR + " : " + CurrencySymbol + toString(GunPriceTR),vec2(50,185))
- This:egpSize(5,30)
- This:egpColor(5,vec(240,240,240))
- }
- # Bottom-Left shipment
- if(GunNameBL != ""&&GunPriceBL != 0){
- This:egpBox(6,vec2(5,270),vec2(10,10))
- This:egpSize(6,vec2(1000,60))
- This:egpColor(6, vec(25))
- This:egpText(7,GunNameBL + " : " + CurrencySymbol + toString(GunPriceBL),vec2(50,255))
- This:egpSize(7,30)
- This:egpColor(7,vec(240,240,240))
- }
- # Bottom-Right shipment
- if(GunNameBR != ""&&GunPriceBR != 0){
- This:egpBox(8,vec2(5,340),vec2(10,10))
- This:egpSize(8,vec2(1000,60))
- This:egpColor(8, vec(25))
- This:egpText(9,GunNameBR + " : " + CurrencySymbol + toString(GunPriceBR),vec2(50,325))
- This:egpSize(9,30)
- This:egpColor(9,vec(240,240,240))
- }
- # Let people know how to use the shop.
- This:egpText(10, "Press E on an option to buy!", vec2(256, 420))
- This:egpAlign(10, 1, 1)
- This:egpSize(10, 25)
- # Let people know who owns this shop.
- This:egpText(11, "Shop owned and operated by "+owner():name(), vec2(256, 460))
- This:egpAlign(11, 1, 1)
- This:egpSize(11, 20)
- # Credit that will surely never be removed by who ever downloads this.
- This:egpText(12, "Shop Dupe and E2 Controller Made by Sony", vec2(256, 480))
- This:egpAlign(12, 1, 1)
- This:egpSize(12, 20)
- # Tiny Reboot Button at the bottom for convenience.
- This:egpBox(13,vec2(256,500),vec2(10,10))
- This:egpSize(13,vec2(50,20))
- This:egpColor(13, vec(0))
- This:egpText(14, "Reboot", vec2(256, 500))
- This:egpAlign(14, 1, 1)
- This:egpSize(14, 10)
- This:egpColor(14,vec(50,50,50))
- # Mark entries as out of stock if the ranger can't find a shipment in that spot.
- if (RangerTL == 0)
- {
- This:egpColor(2, vec(255,50,50))
- This:egpSetText(3,"Out of stock!")
- }
- if (RangerTR == 0)
- {
- This:egpColor(4, vec(255,50,50))
- This:egpSetText(5,"Out of stock!")
- }
- if (RangerBL == 0)
- {
- This:egpColor(6, vec(255,50,50))
- This:egpSetText(7,"Out of stock!")
- }
- if (RangerBR == 0)
- {
- This:egpColor(8, vec(255,50,50))
- This:egpSetText(9,"Out of stock!")
- }
- }
- # What shows on the screen when somone purchases our contents:
- function void wirelink:purchasedScreen()
- {
- EGP:entity():soundPlay(1, 1, Sound_Purchase)
- This:egpClear()
- This:egpCircle(2, vec2(256), vec2(196))
- This:egpColor(2, vec(35))
- This:egpText(3, "Thanks!", vec2(256, 190))
- This:egpAlign(3, 1, 1)
- This:egpSize(3, 100)
- This:egpText(4, ":)", vec2(256, 276))
- This:egpAlign(4, 1, 1)
- This:egpSize(4, 80)
- This:egpText(5, "Enjoy!", vec2(256, 340))
- This:egpAlign(5, 1, 1)
- This:egpSize(5, 50)
- This:egpColor(3, vec(0, 255, 0))
- # Activate the corresponding user to dispense the item from the shipment.
- if (SelectedOption == 1)
- {
- ShipmentUserTL = 1
- }
- elseif (SelectedOption == 2)
- {
- ShipmentUserTR = 1
- }
- elseif (SelectedOption == 3)
- {
- ShipmentUserBL = 1
- }
- elseif (SelectedOption == 4)
- {
- ShipmentUserBR = 1
- }
- else
- {
- print("Something went wrong!")
- }
- timer("Reset", 3000)
- }
- # What shows on the screen when somone tries to buy, but can't:
- function void wirelink:failedScreen()
- {
- EGP:entity():soundPlay(1, 1, Sound_Failed)
- This:egpClear()
- This:egpCircle(2, vec2(256), vec2(196))
- This:egpColor(2, vec(35))
- This:egpText(3, "Failed.", vec2(256, 190))
- This:egpAlign(3, 1, 1)
- This:egpSize(3, 100)
- This:egpText(4, ":(", vec2(256, 276))
- This:egpAlign(4, 1, 1)
- This:egpSize(4, 80)
- This:egpText(5, "Not enough?", vec2(256, 340))
- This:egpAlign(5, 1, 1)
- This:egpSize(5, 50)
- This:egpColor(3, vec(255, 0, 0))
- timer("Reset", 3000)
- }
- EGP:mainScreen()
- }
- Cursor = EGP:egpCursor(User) #Defines Cursor
- function number button(Num){
- return inrange(Cursor,EGP:egpPos(Num),EGP:egpPos(Num) + EGP:egpSize(Num)) #Function for buttons.
- }
- interval(50)
- # When the user selects a button by hovering over it and pressing E.
- if(button(2) && clk() || button(3) && clk()){
- if (RangerTL != 0) {
- moneyRequest(User,GunPriceTL,"Purchase 1x "+GunNameTL+" from shop:")
- SelectedOption = 1
- }
- }
- if(button(4) && clk() || button(5) && clk()){
- if (RangerTR != 0) {
- moneyRequest(User,GunPriceTR,"Purchase 1x "+GunNameTR+" from shop:")
- SelectedOption = 2
- }
- }
- if(button(6) && clk() || button(7) && clk()){
- if (RangerBL != 0) {
- moneyRequest(User,GunPriceBL,"Purchase 1x "+GunNameBL+" from shop:")
- SelectedOption = 3
- }
- }
- if(button(8) && clk() || button(9) && clk()){
- if (RangerBR != 0) {
- moneyRequest(User,GunPriceBR,"Purchase 1x "+GunNameBR+" from shop:")
- SelectedOption = 4
- }
- }
- # Tiny reboot button at the bottom of the screen to quickly reboot the E2 without opening up the shop.
- if(button(13) && clk() || button(14) && clk()){
- prefixPrint("Rebooting in 1 second!")
- timer("Reset", 1000)
- }
- # Purchase success!
- if(moneyClk()){
- EGP:purchasedScreen()
- }
- # Purchase failed, they clicked no or it timed out.
- if(moneyNoClk() | moneyTimeout()){
- EGP:failedScreen()
- }
- if(clk("Reset"))
- {
- reset()
- }
Advertisement
Add Comment
Please, Sign In to add comment