Page 2 of 6

Re: Shop Example Script

Posted: June 18th, 2009, 1:11 am
by johnno56
GoBologna120,

Please correct me if I am wrong.

Maybe you could use the following to detect no money?

if ( < $money 1 ) guitext "Sorry. You have no money."

Just a guess...

J

Re: Shop Example Script

Posted: June 18th, 2009, 6:56 pm
by GoBologna120
Well, the shopkeeper usually only tells you if you don't have enough money. I'd think you'd know if you were broke. :lol:

Re: Shop Example Script

Posted: June 26th, 2009, 4:03 pm
by slyver1988
hey help me i wanna try things out... but were i put this scrips?? :shock:
srry i dont use scripts much xD
i putted it in my .CFG but i only see the invitory :)
how i get shopkeeper and text ^^

Re: Shop Example Script

Posted: June 26th, 2009, 4:31 pm
by GoBologna120
The coins must be set to level_trigger_1 and the shopkeeper must be set to level_trigger_2. Also, the coin is trigger type 12 and the shopkeep is type 11.

Re: Shop Example Script

Posted: July 19th, 2009, 2:31 am
by Doctor
GoBologna120 wrote:It's good to know that I'm contributing something. :mrgreen:
The only thing I'm not sure of at the moment is how to have the shopkeeper tell you if you don't have enough money.
I don't know how to script that much if at all but. couldn't you just run a script that asks for the players inventory and if they have the currency thats used at that shop? Like my really bad example:
(check player inventory for "blah blah")
(if player has "blah blah" let them buy it)
("else" play message: I'm sorry but you don't have enough money for this item)
(end sub)

Re: Shop Example Script

Posted: August 17th, 2009, 8:34 am
by Mama's Boy
I've got something for you. I redid some things, so just put this back in your cfg. It's mostly your work anyway :)

Code: Select all

"on_start" = [

   money = 0

   pie = 0

   sword = 0

   treasure = 0

   ]



"level_trigger_1" = [ money = ( + $money 5 ) 

   echo "You got 5 moneys."

   ]



"level_trigger_2" = "showgui Shopkeeper"



newgui Shopkeeper [

   guitext "What're ya buyin, stranger?" chat

   guibar

   guilist [

      guibutton "Pie: 10 moneys" [

         if ( > $money 9 ) [

            money = ( - $money 10 )

            pie = ( + $pie 1 )

         ] [showgui NotEnough]

      ]

      guibar

      guibutton "Sword: 20 moneys" [

         if ( > $money 19 ) [

            money = ( - $money 20 )

            sword = ( + $sword 1 )

            ] [showgui NotEnough]

         ]

      guibar

      guibutton "Treasure: 40 moneys" [

         if ( > $money 39 ) [

            money = ( - $money 40 )

            treasure = ( + $treasure 1 )

            ] [showgui NotEnough]

         ]

   ]

]

newgui NotEnough [
	guitext "Sorry, you don't have enough moneys." chat
	guibar
	guilist [
		guibutton "I'll buy something else." "showgui Shopkeeper"
		guibar
		guibutton "Goodbye." "cleargui"
	]
] "Shopkeeper"



newgui Inventory [

guibutton "Back" "cleargui 1"

guibar

guitext ( format "You have %1 moneys in your wallet." $money )

guitext ( format "You have %1 pies.  Yum." $pie )

guitext ( format "You have %1 swords.  Not that you can use them..." $sword )

guitext ( format "You have %1 treasures.  Lucky you!" $treasure )

]



newgui main [

   guilist [

      guilist [

         guibutton "Inventory" "showgui Inventory"

      ]

   ]

   guibar

   @main

]
It's just like the old one, but if you can't afford something, the shopkeeper will tell you, and you can either say goodbye or continue shopping.

Re: Shop Example Script

Posted: September 20th, 2009, 11:58 pm
by OrbitalRider
Heres the code to make it where the shopkeeper tells you u dont have enough gold if you havent figured it out yet. only prob is you have to type out another "newgui" but atleast theres a copy and paste option :)!!!!

Code: Select all

if ( < $money 10 ) "showgui ShopKeeper"
        
 newgui ShopKeeper [
    guitext ( format "You only have %1 gold." $money )   
          guibar
           guibutton "ok" [
          cleargui -1 ]
Ofcourse you can change what you want him to say, i just made it where it reminds me how much i have. Also you could take out the "ok" button if you use the keyboard to to exit menus.

And if you didnt want to have a new menu pop up you could always use

Code: Select all

echo "You dont have enough gold"
so that it would just show up as little text in the corner of the screen. Either way, well there ya go pretty simple.

oh! don't forget to put however many "]" you need. itll tell you if theres one missing.

Re: Shop Example Script

Posted: November 11th, 2009, 12:22 am
by bradels
thank you this alone has thought me a lot :D

EDIT: sorry for double post would this work. as a addon to yours

Code: Select all

]

"level_trigger_3" = "showgui chest" [money=(=+$money 5)

]

newgui chest [

guitext " wow you obtained 20 coins for your jounerny"
guibar
guilist[
guibutton "leave unlocked in hopes some kind stanger will refill it (i mean howd it get in there in the first place"
]








i say this because i don't know how to assing level trigger

Re: Shop Example Script

Posted: January 3rd, 2010, 4:14 pm
by Creatorrookie
Does the shop script work in the sandbox rpg and 2.4?

Re: Shop Example Script

Posted: January 3rd, 2010, 7:52 pm
by GR1M
Yes it does.