Difference between revisions of "Creating a shop script"
From Platinum Arts Sandbox Free 3D Game Maker
Line 3: | Line 3: | ||
"on_start" = [ | "on_start" = [ | ||
− | |||
money = 0 | money = 0 | ||
− | |||
pie = 0 | pie = 0 | ||
− | |||
sword = 0 | sword = 0 | ||
− | |||
treasure = 0 | treasure = 0 | ||
− | |||
] | ] | ||
− | |||
− | |||
− | |||
"level_trigger_1" = [ money = ( + $money 5 ) | "level_trigger_1" = [ money = ( + $money 5 ) | ||
− | |||
echo "You got 5 moneys." | echo "You got 5 moneys." | ||
− | |||
] | ] | ||
− | |||
− | |||
− | |||
"level_trigger_2" = "showgui Shopkeeper" | "level_trigger_2" = "showgui Shopkeeper" | ||
− | |||
− | |||
− | |||
newgui Shopkeeper [ | newgui Shopkeeper [ | ||
− | |||
guitext "What're ya buyin, stranger?" chat | guitext "What're ya buyin, stranger?" chat | ||
− | |||
guibar | guibar | ||
− | |||
guilist [ | guilist [ | ||
− | |||
guibutton "Pie: 10 moneys" [ | guibutton "Pie: 10 moneys" [ | ||
− | |||
if ( > $money 9 ) [ | if ( > $money 9 ) [ | ||
− | |||
money = ( - $money 10 ) | money = ( - $money 10 ) | ||
− | |||
pie = ( + $pie 1 ) | pie = ( + $pie 1 ) | ||
− | |||
] | ] | ||
− | |||
] | ] | ||
− | |||
guibar | guibar | ||
− | |||
guibutton "Sword: 20 moneys" [ | guibutton "Sword: 20 moneys" [ | ||
− | |||
if ( > $money 19 ) [ | if ( > $money 19 ) [ | ||
− | |||
money = ( - $money 20 ) | money = ( - $money 20 ) | ||
− | |||
sword = ( + $sword 1 ) | sword = ( + $sword 1 ) | ||
− | |||
] | ] | ||
− | |||
] | ] | ||
− | |||
guibar | guibar | ||
− | |||
guibutton "Treasure: 40 moneys" [ | guibutton "Treasure: 40 moneys" [ | ||
− | |||
if ( > $money 39 ) [ | if ( > $money 39 ) [ | ||
− | |||
money = ( - $money 40 ) | money = ( - $money 40 ) | ||
− | |||
treasure = ( + $treasure 1 ) | treasure = ( + $treasure 1 ) | ||
− | |||
] | ] | ||
− | |||
] | ] | ||
− | |||
] | ] | ||
− | |||
] | ] | ||
− | |||
− | |||
− | |||
newgui Inventory [ | newgui Inventory [ | ||
− | |||
guibutton "Back" "cleargui 1" | guibutton "Back" "cleargui 1" | ||
− | |||
guibar | guibar | ||
− | |||
guitext ( format "You have %1 moneys in your wallet." $money ) | guitext ( format "You have %1 moneys in your wallet." $money ) | ||
− | |||
guitext ( format "You have %1 pies. Yum." $pie ) | 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 swords. Not that you can use them..." $sword ) | ||
− | |||
guitext ( format "You have %1 treasures. Lucky you!" $treasure ) | guitext ( format "You have %1 treasures. Lucky you!" $treasure ) | ||
− | |||
] | ] | ||
− | + | ||
− | + | ||
− | + | ||
newgui main [ | newgui main [ | ||
− | |||
guilist [ | guilist [ | ||
− | |||
guilist [ | guilist [ | ||
− | |||
guibutton "Inventory" "showgui Inventory" | guibutton "Inventory" "showgui Inventory" | ||
− | |||
] | ] | ||
− | |||
] | ] | ||
− | |||
guibar | guibar | ||
− | |||
@main | @main | ||
− | |||
] | ] |
Revision as of 15:05, 18 November 2009
This is a shop example script for you to edit to your liking.
"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 ) ] ] guibar guibutton "Sword: 20 moneys" [ if ( > $money 19 ) [ money = ( - $money 20 ) sword = ( + $sword 1 ) ] ] guibar guibutton "Treasure: 40 moneys" [ if ( > $money 39 ) [ money = ( - $money 40 ) treasure = ( + $treasure 1 ) ] ] ] ] 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 ]