function name variable?

Discussion and feedback on Construct 2

Post » Sat Feb 15, 2014 10:07 pm

since when is using a string variable in functions not possible?

i even tried with constant variable, nopes

has this been changed maybe?
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Sun Feb 16, 2014 2:45 am

@vtrix, in the past twenty releases I've used, I don't think it was ever possible. Just, about 5-10 or so releases ago, a using a constant string variable didn't give an error until compile-time, as opposed to at the time you add it.
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Sun Feb 16, 2014 3:11 am

@vtrix, I am not sure exactly what you mean... I just tried half a dozen ways of using a string variables with functions and they all worked.
I passed a string variable in as a parameter, accessed a global string variable, and even called a function by assigning the name of the function I wanted to call in a string variable.

(I am running version 161)
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Sun Feb 16, 2014 10:01 am

@danialgoodwin

i think it worked with rex function in the early days, i didn't need this because i wasn't using functions alot but now it would be helpfull

@AllanR

its on function "name" , i want it to be a variable
so i can rename my funtions more easy

does that work for you?
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Sun Feb 16, 2014 5:54 pm

[QUOTE=vtrix] @danialgoodwin

i think it worked with rex function in the early days, i didn't need this because i wasn't using functions alot but now it would be helpfull

@AllanR

its on function "name" , i want it to be a variable
so i can rename my funtions more easy

does that work for you?
[/QUOTE]
@vtrix

Never worked for me to set the function, however, I think you can call functions with a variable (not sure about that).

Maybe a dictionnary can work for that?Aphrodite2014-02-16 17:54:46
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Feb 16, 2014 6:24 pm

There is a typo I have made before:

Make sure the variable of the function name is NOT in quotes, or else the system will make the decision ""name""=/="name"
B
2
Posts: 5
Reputation: 160

Post » Mon Feb 17, 2014 3:31 am

@Aphrodite

yes calling works, but to be usefull, on funtion "string" should take the string of the variable

this way you can just rename the functions at one place

not sure how a dictionnary would help... to keep track of my functions?
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Mon Feb 17, 2014 10:11 am

[QUOTE=vtrix] @Aphrodite

yes calling works, but to be usefull, on funtion "string" should take the string of the variable

this way you can just rename the functions at one place

not sure how a dictionnary would help... to keep track of my functions?[/QUOTE]

Now that I think abut it, the dictionnary may be more confusing..

Personnally I like to have all functions in one event sheet, maybe you could do like this:

Global variable : FunctionName = "My function"
On Function "My Function"
Global variable : FunctionName = "My function2"
On Function "My Function2"

So you have the two things to edit in the same place

Then you call functions only with the global variables
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 25 guests