Better explanation would be he want a function that include a string as part of the code, for example include("MeleeInit()"); However I don't think that is possible, you can write your own function that run depends on the string parameter you pass in though
You can use triggers to do this.
I wrote a little bit about how to write triggers in custom script here: http://forums.sc2mapster.com/development/galaxy-scripting-and-trigger-lib/13830-trigger-execution-help/#p4
You basically do what I explained in there, but you can see that the CreateTrigger function takes a string. That's where you can put your input string in.
Then you just have to make an own Trigger which runs when a user enters something.
So, dann regeln wir das mal auf verständliche Weise :)
Was willst du denn mit der Script-variable anstellen?
Der Name der Variable sollte lv_script sein, also hast du das richtig.
Willst du im es im Endeffect so machen, dass du z.b. script auf "set a=b" setzt und dann soll dieser Befehl in custom script umgewandelt werden?
Wenns das ist, dann muss ich Dich enttäuschen, dass geht nicht.
Translation for the German-ignorants
What exactly do you want to do with that script variable.
It's name should be lv_script, so you got that right.
Do you want to be able to input something like "set a=b" and then run this order as custom script?
If yes then I have to disappoint you, this isn't possible.
I'd say he just wasn't aware of the difference between texts and strings :3
But even with strings it cannot be done easily.
You'd need to set up a data table with all functions and basically create your own little compiler to process your commands.
Not regarding the fact that there is no way to turn a string into a variable name.
And since there are no void pointers you'd have to make seperate cases for most variable types.
Even a simple "set x = y" would be an insane amount of script and work.
Hi guys, i have an problem.
My mod does create an file, with an code.
And i have to copy this code, and paste it in an trigger.
My problem is, how can i use the text from an variable as code.
Example:
I have an text variable. The variable has the text "include".
How can i run the text as an code?
PS: Sry, my english is not very good.
If you dont understand what i mean, i will upload an screenshot
Do you mean you have a string like "include" and then you want to make it call a function which is also called "include"?
yeah
Better explanation would be he want a function that include a string as part of the code, for example include("MeleeInit()"); However I don't think that is possible, you can write your own function that run depends on the string parameter you pass in though
@progammer: Go
no, s3rius has understand what i mean
You can use triggers to do this.
I wrote a little bit about how to write triggers in custom script here: http://forums.sc2mapster.com/development/galaxy-scripting-and-trigger-lib/13830-trigger-execution-help/#p4
You basically do what I explained in there, but you can see that the CreateTrigger function takes a string. That's where you can put your input string in.
Then you just have to make an own Trigger which runs when a user enters something.
here is an screenshot.
nobody does understand my problem^^
http://img834.imageshack.us/img834/4231/starcraft2editorproblem.png
edit: sry, my editor is german
So, dann regeln wir das mal auf verständliche Weise :)
Was willst du denn mit der Script-variable anstellen?
Der Name der Variable sollte lv_script sein, also hast du das richtig.
Willst du im es im Endeffect so machen, dass du z.b. script auf "set a=b" setzt und dann soll dieser Befehl in custom script umgewandelt werden?
Wenns das ist, dann muss ich Dich enttäuschen, dass geht nicht.
Translation for the German-ignorants
What exactly do you want to do with that script variable.
It's name should be lv_script, so you got that right.
Do you want to be able to input something like "set a=b" and then run this order as custom script?
If yes then I have to disappoint you, this isn't possible.
@s3rius: Go
nein. also:
Das, was in der Text variable drinnen ist, soll als ganz normalen code ausgeführt werden.
Also: Die Text variable beinhaltet den code schon, nur ich kann keine Variablen ausführen lassen.
@Swordman1: Go
Das geht nicht. Sowas kann Galaxy nicht.
@s3rius: Go
ok, dann muss ich es anders lösen.
Kann ich über irgend einen code ne galaxy datei ausführen lassen?
Denn ich kann auch einfach ne .galaxy datei erstellen lassen, und diese muss man dann importieren und dann über auslöser irgendwie aktivieren.
Das MUSS doch gehen, oder?
@Swordman1: Go
Nein, galaxy files kannst du zwar importieren, aber die Funktionen darin musst du trotzdem wieder ganz normal ausführen.
Wenn du das wirklich machen willst, ist die einzige Möglichkeit, die mir einfällt eine laaaaaaaange liste von if-then-else.
@s3rius: Go
-.-
ok, dann ist galaxy echt fürn *, wenn ich nicht mal das machen kann.
omfg. wtb german to engish converter.
Lol, I couldn't even tell WHAT they were speaking lol. :D I'm an ENGLISH ONLY VIKING decendant. :D
Edit: Oh, and a comment on your grammer for english. You write like this...
"I see an car."
When it should be...
"I see a car"
We write "a" most of the time, but we put "an" before vowels like this...
"I see an airplane" (Just wanted to let you know) :D
This thread has been blitzkzerged. On topic, I think I understand what he mean and that is not possible
@progammer: Go
you can use word of string. then use triggers and fucntions to handle the compile of the word string lines.
this is very interesting topic I have been looking at myself.
The op is specifically speaking of text, not strings. Since there is no TextToString, I would still call it impossible.
Using strings as described is an interesting story, though ;)
@Kueken531: Go
I'd say he just wasn't aware of the difference between texts and strings :3
But even with strings it cannot be done easily.
You'd need to set up a data table with all functions and basically create your own little compiler to process your commands.
Not regarding the fact that there is no way to turn a string into a variable name.
And since there are no void pointers you'd have to make seperate cases for most variable types.
Even a simple "set x = y" would be an insane amount of script and work.