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 Basics

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.
User avatar
DaGeek247
Member
Member
Posts: 53
Joined: May 17th, 2010, 6:52 pm
Name: DaGeek247
IRC Username: DaGeek247
Location: sitting or standing when not laying down
Contact:

Cubescript Basics

Post by DaGeek247 »

Hey, first off, how do i remove the user of my game ability to go into edit mode? the following code was my best attempt to fix it, but it fails.

Code: Select all

//below keeps user from entering edit mode. to bad it doesnt work.
editbind "E" [if (&& (= $shiftkey 0) (= $ctrlkey 0)) [echo "Whoops! No cheating!!!"]
   if (&& (= $shiftkey 0) (= $ctrlkey 1)) [echo "Whoops! No cheating!!!"]
   if (&& (= $shiftkey 1) (= $ctrlkey 0)) [echo "Whoops! No cheating!!!"]
   if (&& (= $shiftkey 1) (= $ctrlkey 1)) [echo "Whoops! No cheating!!!"]]

How do I get it to work?

Secondly, How does the basic syntax of variables in cubescript work? I want for a chest trigger to set a variable, and echo something. I got the echo part to work, but i have no idea how variables work here. How do I
A. Set a variable
B. Echo or use the contents of a variable?

thirdly, (and lastly) how do if statements in cubescript work? I have a trigger type 9 door, and i want it to open ONLY if a variable has been set by the trigger. how do i do this?

Any help would be MOST appreciated.
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report

DaGeek247 of http://dageek247.tk/
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: Cubescript Basics

Post by arcones »

Here are two tutorials for removing edit mode: (I prefer the first one)
Tutorial for removing edit mode
Removing edit mode

Geek, please check out other posts concerning Cubescript as I've already answered this question. Also, there is a tutorial for Cubescript that has several links attached to it ;)

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: Cubescript Basics

Post by chocolatepie33 »

for #2 and #3, with variables, you initialize them with the "on_start = [" command, then you can use guibuttons and level triggers to add to them.
Here's an example code:

Code: Select all

on_start = [
money = 0
]

level_trigger_1 = [showgui CP]
newgui CP [
guitext "Would you like 5 dollars?"
guibar
guibutton "Sure." [ money = ( + $money 5 ) ; cleargui]
guibutton "Nah, I'm fine." [cleargui]
]

level_trigger_2 = [ money = ( + $money 500 ) ]         // a bag of coins


with #3, to do something like that (I'm surprised Arc didn't say this, I think I got this from him a bit ago), it's something like this:

Code: Select all

level_trigger_3 = [ if ( > $key 0 ) [ trigger 3 1 ; key = ( - $key 1 ) ] ]

the first number after trigger (3) is the level trigger. The 1 is a boolean value, meaning it is true or false. The 1 lets the door open. An elevator has a code of 1, 0, or -1. 1 starts an elevator up, 0 stops it, and -1 makes it go down, like a sideways number line.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
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: Cubescript Basics

Post by arcones »

Aye,

@Geek here's a by far the best example of syntax I have ever seen for CS.
Shop Script Example

@CP, you probably did get it from me, but I got it from the shop script. And Chocolate, the reason I keep giving people sites to learn CS, is because until they do, they'll continually come back for help. This topic right here kinda explains why: Scripting

Anyway, there are tons of Support questions about CS, so just keep checking and I'm sure you'll see more answers for your questions.
Image
Want a user bar like this one? PM Leo!
User avatar
DaGeek247
Member
Member
Posts: 53
Joined: May 17th, 2010, 6:52 pm
Name: DaGeek247
IRC Username: DaGeek247
Location: sitting or standing when not laying down
Contact:

Re: Cubescript Basics

Post by DaGeek247 »

one last question, how do remove edit mode from only ONE game?
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report

DaGeek247 of http://dageek247.tk/
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: Cubescript Basics

Post by arcones »

What do you mean?

For one map, or if you wanted to post a standalone game and remove the edit mode for that?
Image
Want a user bar like this one? PM Leo!
User avatar
DaGeek247
Member
Member
Posts: 53
Joined: May 17th, 2010, 6:52 pm
Name: DaGeek247
IRC Username: DaGeek247
Location: sitting or standing when not laying down
Contact:

Re: Cubescript Basics

Post by DaGeek247 »

no. how would i remove edit mode in one map via cubescript in the cfg file? that was my REAL question.
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report

DaGeek247 of http://dageek247.tk/
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Cubescript Basics

Post by chocolatepie33 »

so, you're taking it out of one map, not out of all of Sandbox, right?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
DaGeek247
Member
Member
Posts: 53
Joined: May 17th, 2010, 6:52 pm
Name: DaGeek247
IRC Username: DaGeek247
Location: sitting or standing when not laying down
Contact:

Re: Cubescript Basics

Post by DaGeek247 »

yes, that is correct.
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report

DaGeek247 of http://dageek247.tk/
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: Cubescript Basics

Post by arcones »

Actually, it's better if it's a game (with multiple maps) to just extract the program as a game itself instead of just trying to lock-out edit mode in one map. Someone can always go into the map.cfg and delete the code that doesn't allow editing.

All the maps thus far posted on this forum have allowed edit mode (even some maps that were puzzle/adventure maps). So, unless it is a game, it's best to just leave it.
Image
Want a user bar like this one? PM Leo!
Locked