Text going to new line when a # is in the string
#1
Posted 07 April 2012 - 05:27 PM
I am making a little app to aid in the creation of scripts. As some of you probably know, a .gml script file begins with "#define Script". Therefore when that text is read (to display the file you're creating from inside game maker) it skips a line and begins printing the text a line below. Is there any possible way to fix this issue? Any and all help is appreciated! Thank You!
M
#2
Posted 07 April 2012 - 05:34 PM
E.G.
txt = "This is line #1";
outputs
This is line
1
Whareas:
txt = "This is line \#1";
Outputs
This is line 1;
You can also replace all occurrences of a substring within a string:
new_str = string_replace_all("#",old_str);
#3
Posted 07 April 2012 - 05:36 PM
You can use \ as a prefix to escape the next character:
E.G.
txt = "This is line #1";
outputs
This is line
1
Whareas:
txt = "This is line \#1";
Outputs
This is line 1;
You can also replace all occurrences of a substring within a string:
new_str = string_replace_all("#",old_str);
So I can simply modify the text that is drawn and leave the file unchanged?
EDIT: Okay yeah I see. Thanks man, +1-ed.
Edited by MetroidMan347, 07 April 2012 - 05:37 PM.
#4
Posted 07 April 2012 - 05:50 PM
You can also replace all occurrences of a substring within a string:
new_str = string_replace_all("#",old_str);
You missed an argument, and mixed up the order in the quoted function; it should be:
new_str = string_replace_all(old_str,"#","");
#5
Posted 07 April 2012 - 07:46 PM
Don't worry, I fixed it before I used it.You can also replace all occurrences of a substring within a string:
new_str = string_replace_all("#",old_str);
You missed an argument, and mixed up the order in the quoted function; it should be:new_str = string_replace_all(old_str,"#","");
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











