Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them. If you have any questions please e-mail me through the Platinum Arts website.

Cubescript Syntax?

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
dhillis
Member
Member
Posts: 33
Joined: September 28th, 2010, 11:15 am
Name: Daniel

Cubescript Syntax?

Post by dhillis »

I pasted some code below. This is my .cfg file. I am trying to make it where when you walk up to npcman the first time that he ask you to pick up 5 apples from around the map for you. Then after that he ask you to bring him the apples. Just trying to get use to the if statements. Any help please?




on_start = [
approach = 2
echo $approach
]

level_trigger_1 = [
echo "You just picked up an apple"
]

level_trigger_2 = [
if ( $approach = 2) [
showgui npc1
approach = 3
echo $approach
]
if ( $approach = 3) [
showgui npc2
echo $approach
]
]

newgui npc1 [
guitext "I have lost 5 apples. Can you please find five apples on the map and bring them to me?"
guibutton "Close" [cleargui]
]

newgui npc2 [
guitext "Please bring me some apples"
guibutton "Close" [cleargui]
]
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Cubescript Syntax?

Post by chocolatepie33 »

first off, use the code button to put it into code.
second, I think you might be looking for something like this:

Code: Select all

on_start = [
approach = 2
]

level_trigger_1 = [
echo "You just picked up an apple."
]

level_trigger_2 = [
if ( $approach = 2 ) [showgui npc1-1]
approach = ( + $approach 1 )
if ( $approach = 3 ) [showgui npc2-1]
]

newgui npc1-1 [
guitext "I have lost 5 apples. Can you please find five apples from around here and bring them to me?"
guibar
guibutton "Sure." [cleargui]
guibutton "Whatever." [cleargui]
] "(NAME)"

newgui npc1-2 [
guitext "Please bring me some apples."
guibar
guibutton "Okay." [cleargui]
] "(NAME)"



Some of this might be wrong, it's been a good while since I've last done coding.

You should probably add an apple value keeper, and an inventory while you're at it. I'd try some of the stuff here: http://sandboxgamemaker.com/wiki/index.php?title=Ultimate_Simple_script_guide and here: http://sandboxgamemaker.com/wiki/index.php?title=Ultimate_Simple_script_guide_part2
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
dhillis
Member
Member
Posts: 33
Joined: September 28th, 2010, 11:15 am
Name: Daniel

Re: Cubescript Syntax?

Post by dhillis »

I am adding a apple value keeper and all that stuff. I am trying to do a little at a time in my classes to spread it over many weeks. Actually have a kid in one of my classes that already has a working inventory and was able to do put "poisionous" mushrooms on the map that took away from his health and killed him. He also kept up with how many lives had been used. I haven't coded in about 8 years before this and that was c++ so i understand the code but the syntax is a little different.

I did put you code in my .cfg file and now the npc does pop up a gui at all...lol Back to work. Hopefully I don't get to bad a headache.
Locked