Page 1 of 1

Cubescript Syntax?

Posted: March 25th, 2011, 3:05 pm
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]
]

Re: Cubescript Syntax?

Posted: March 25th, 2011, 6:47 pm
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. ... ript_guide and here: http://sandboxgamemaker.com/wiki/index. ... uide_part2

Re: Cubescript Syntax?

Posted: March 28th, 2011, 8:21 am
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.