Shop Example Script

Learn more on how to use Sandbox, or submit your own tutorials or resources.
User avatar
Dunstan
Member
Member
Posts: 7
Joined: January 20th, 2011, 7:32 am
Name: Bela Selmeci
Location: Budapest, Hungary
Contact:

Re: Shop Example Script

Postby Dunstan » January 31st, 2011, 7:18 am

You can create a more graphical shop script and a more graphical directory by using the third parameter in "guibutton" and the second parameter in "guitext". It determines the icon, which is in front of your text. You can create 128x128 PNG images of the things your shop offers, and put it in a directory data/hud/xxx/icons/inventory. Then you can use these images like this:

Code: Select all

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

or:

Code: Select all

           guibutton "Pie: 10 moneys" [
              if ( > $money 9 ) [
                 money = ( - $money 10 )
                 pie = ( + $pie 1 )
              ]
           ] "inventory/pie.png"

To determine xxx, which is the version of hud (which means heads up display, I think) you are using, try to use the modified script. If Sandbox doesn't find the images you specified, it gives an error message, which contains the full path to the icons directory.
You can also use these options to display the face of the character, who is talking to you:

Code: Select all

guitext "What're ya buyin, stranger?" "chars/shopkeeper.png"
Last edited by Dunstan on February 1st, 2011, 4:00 am, edited 2 times in total.

chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Shop Example Script

Postby chocolatepie33 » January 31st, 2011, 6:02 pm

You can modify the gui, you know, such as adding your own icons and stuff... If that helps.
Julius wrote:Contribute to http://www.opengameart.org NOW!

Save the wiki!

User avatar
Dunstan
Member
Member
Posts: 7
Joined: January 20th, 2011, 7:32 am
Name: Bela Selmeci
Location: Budapest, Hungary
Contact:

Re: Shop Example Script

Postby Dunstan » February 1st, 2011, 3:56 am

chocolatepie33 wrote:You can modify the gui, you know, such as adding your own icons and stuff... If that helps.


That is exactly what I wrote, although my intention was to amend the original, not to create a new one. It is not so difficult, so a beginner can also use it, and it will make the game nicer. ;)

arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Shop Example Script

Postby arcones » February 1st, 2011, 10:11 am

I have to say, that's pretty nifty. Good work.

Arcones
Image
Want a user bar like this one? PM Leo!

chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Shop Example Script

Postby chocolatepie33 » February 1st, 2011, 3:19 pm

Dunstan wrote:
chocolatepie33 wrote:You can modify the gui, you know, such as adding your own icons and stuff... If that helps.


That is exactly what I wrote, although my intention was to amend the original, not to create a new one. It is not so difficult, so a beginner can also use it, and it will make the game nicer. ;)


Well, I mean you can create your own icons, not pulling up certain ones that are already there... like you could make a chicken icon if you needed to whereas the guis don't normally have one. But yeah, I think we're on the same page.
Julius wrote:Contribute to http://www.opengameart.org NOW!

Save the wiki!

User avatar
Dunstan
Member
Member
Posts: 7
Joined: January 20th, 2011, 7:32 am
Name: Bela Selmeci
Location: Budapest, Hungary
Contact:

Re: Shop Example Script

Postby Dunstan » February 2nd, 2011, 1:40 am

It seems, the authors have thought about it as well: in the hud/2.3 there are robochimp and ogre icons. So, if you use an ogre as shopkeeper, put "ogre" in place of "chat", like this:

Code: Select all

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

salomonders
Member
Member
Posts: 4
Joined: May 8th, 2011, 10:30 am
Name: Justus

Re: Shop Example Script

Postby salomonders » May 14th, 2011, 9:24 am

Very Nice script why we not make a Anial Crossing like Tom nook?
This will be nice for kids.
Or lets make a mod for PAS Like Dopewars but in 3D and with a Big sized City

Scry for my English XD
XD Sorry For my English
My Name in Sauerbraten : Salomonder

User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Shop Example Script

Postby Leo_V117 » May 16th, 2011, 12:25 pm

Hey, pretty good work... For Rookies! =3

Lets see what else you can do!

User avatar
joeSephALien
Member
Member
Posts: 2
Joined: October 11th, 2011, 12:53 am
Name: AllenJoeseph
IRC Username: joeSephALien

Re: Shop Example Script

Postby joeSephALien » October 11th, 2011, 1:25 am

Great help Leo.
I've DL the EasyScriptBuilder, and I had a little problem making the script for the first time until I read this thread
viewtopic.php?f=9&t=2802.
Orlando Bloom wrote:I don't do a film unless it has a GI Joe sword in it. And if it doesn't have a GI Joe sword in it, I insist that they have one in the same room to keep me comfortable.

ArtFan
Member
Member
Posts: 1
Joined: February 11th, 2012, 1:53 pm
Name: Anthony

Re: Shop Example Script

Postby ArtFan » February 14th, 2012, 5:15 pm

Hirato wrote:*grumble grumble*
docs are written not to be read
*grumble grumble*
http://sandboxgamemaker.com/wiki/index. ... FDecisions
*grumble grumble*

just keep in mind there's a 25 word limit, the command is the first so you can provide up to 24 additional arguments


Ahhh, thanks for clearing that up :mrgreen:


Return to “Tutorials and Resources”

Who is online

Users browsing this forum: No registered users and 1 guest