I wrote a random maze generator in Galaxy Script, and it all compiles. However, when I go to run it, an error in-game occurs when I fire the event (a chat message). The code that should fire is as follows (I won't show all functions for sake of size)
include "TriggerLibs/natives"
include "TriggerLibs/NativeLib"
FuzzYD -
I forgot to add that triggering in Mod files isn't possible, but it should be. I had it in my head as I was writing this, but forgot to type it in.
In C + +, we can also pass values to the variables when we call a function/method.
Example Here:
string ello = reusethis ("hi",67);
My Question is why can't we do this in Galaxy?
It would make it a lot easier to code if this was true.
For instance, if I wanted a spawn system, I could create a function/method that gets sent an array of regions from a map, and returns a spawn number for units to be spawned. This could be placed in a Mod file, and be reused.
I think this would make coding in Galaxy much more worthwhile.
If you have any other reusable ideas, please post them here!
- ChosenOreo
P.S - If there is a way to do this, I haven't found it. If someone who does know about this could direct me to a resource that shows how, please, post that too!
0
I wrote a random maze generator in Galaxy Script, and it all compiles. However, when I go to run it, an error in-game occurs when I fire the event (a chat message). The code that should fire is as follows (I won't show all functions for sake of size)
include "TriggerLibs/natives"
include "TriggerLibs/NativeLib"
void InitTriggers();
void InitLibs();
void InitGlobals();
bool Maze();
/ Triggers
trigger t_Maze;
void InitMap () {
InitLibs();
InitTriggers();
InitGlobals();
}
void InitLibs () {
libNtve_InitLib();
}
void InitTriggers() {
t_Maze = TriggerCreate("Maze");
TriggerAddEventChatMessage(t_Maze, c_playerAny, "-newMaze", true);
}
void InitGlobals() {
}
bool Maze() {
return true;
}
0
FuzzYD - I forgot to add that triggering in Mod files isn't possible, but it should be. I had it in my head as I was writing this, but forgot to type it in.
- ChosenOreo
0
Why can't we use reusable functions/methods, and code triggers in Mod files?
Currently, we CANNOT put triggers in Mod Files!!
I feel we should be able to code reusable functions/methods in Mod files so we can reuse code many times without recopying or retyping.
FOR INSTANCE
In C + +, I can write (after importing headers and declaring namespaces):
string reusethis (string something, int somethingelse)
{
something = "hello!";
somethingelse = 567;
cout << "Variables are... " << something << " | " << somethingelse << endl;
string combine = "word is: " + something;
return combine;
}
In C + +, we can also pass values to the variables when we call a function/method.
Example Here:
string ello = reusethis ("hi",67);
My Question is why can't we do this in Galaxy? It would make it a lot easier to code if this was true.
For instance, if I wanted a spawn system, I could create a function/method that gets sent an array of regions from a map, and returns a spawn number for units to be spawned. This could be placed in a Mod file, and be reused.
I think this would make coding in Galaxy much more worthwhile.
If you have any other reusable ideas, please post them here!
- ChosenOreo
P.S - If there is a way to do this, I haven't found it. If someone who does know about this could direct me to a resource that shows how, please, post that too!