What is the syntax for creating a method?

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
Venima
Support Team
Support Team
Posts: 259
Joined: February 17th, 2010, 4:56 am
Name: Tombstone
IRC Username: Venima
Location: Somewhere in the eternal planes between the living and the dead

What is the syntax for creating a method?

Postby Venima » August 3rd, 2010, 10:48 am

What is the syntax for creating a method?

To show you roughly what I mean, newgui <name> [] creates a gui. But I want to run a block of code that doesn't have a gui, but does have a name.

What is the syntax for:

1. Creating the method (e.g. in C++ it would be something like void <name> {etc.})

2. Calling the method (e.g. in C++ it would be <name>();)
Tombstone's Tournament round 2 has begun! Tombstone's Posting Tournament

Try out my: CFG Easy Text Editor (Note: still in beta)

-----Venima
Image
Image

Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: What is the syntax for creating a method?

Postby Hirato » August 3rd, 2010, 8:17 pm

in cubescript these are called aliases. the proper term for those things in other programming languages, is function.
there are plenty of examples here http://sandboxgamemaker.com/wiki/index. ... Cubescript

Code: Select all

  myalias = [echo hi!]
  myalias


I'll write something a bit later regarding arguments
This is not a url, clicking it is pointless

User avatar
Venima
Support Team
Support Team
Posts: 259
Joined: February 17th, 2010, 4:56 am
Name: Tombstone
IRC Username: Venima
Location: Somewhere in the eternal planes between the living and the dead

Re: What is the syntax for creating a method?

Postby Venima » August 4th, 2010, 4:27 pm

ahhh right...that makes sense now thanks.
Tombstone's Tournament round 2 has begun! Tombstone's Posting Tournament

Try out my: CFG Easy Text Editor (Note: still in beta)

-----Venima
Image
Image


Return to “Sandbox General Support”

Who is online

Users browsing this forum: No registered users and 3 guests