Is this possible? or how can I -
Jay. - 13.05.2011
Well, I now know you can replace codes with ctrl + h, but is it possible for example. Instead of replacing it, select all of the lines you wanted. like in h, but not replacing just selecting, I have a really long objects script that takes for ever to select. So is this possible? Or can someone give me a program that can do it, I use the default pawno that comes with the server package btw.
PS: please reply with useful/helpful posts, or don't bother posting at all
Thanks
Re: Is this possible? or how can I -
Mauzen - 13.05.2011
If you want to copy all these lines, i would just write a small script for this (read the file line for line, check if the line starts with CreateObject or if it occurs in that line, if yes append it to another file)
Else I dont know any editor that supports multiple seperate selections for windows, seems to be a rare feature.
Quote:
Originally Posted by Funtime
PS: please reply with useful/helpful posts, or don't bother posting at all
|
Its a shame that we actually have to mention this in this forum, but i totally agree with you.
Re: Is this possible? or how can I -
Jay. - 13.05.2011
Quote:
Originally Posted by Mauzen
If you want to copy all these lines, i would just write a small script for this (read the file line for line, check if the line starts with CreateObject or if it occurs in that line, if yes append it to another file)
Else I dont know any editor that supports multiple seperate selections for windows, seems to be a rare feature.
Its a shame that we actually have to mention this in this forum, but i totally agree with you.
|
Okay thanks but I really have no idea how to script one. but it's really important and would save alot of time. I'm just going to ask, mind creating me one? I don't really mind. if not i'll just wait for other replies and maybe an editor suggestion.
Thanks again
Re: Is this possible? or how can I -
Mauzen - 14.05.2011
No problem, its just some lines:
pawn Код:
stock ExtractLines(const conatins[], const sourcefile[], const targetfile[])
{
new File:s = fopen(sourcefile),
File:t = fopen(targetfile);
new line[128];
new extracted;
while(fread(s, line))
{
if(strfind(line, contains, true) != -1)
{
fwrite(t, line);
extracted++;
}
}
fclose(s);
fclose(t);
return extracted;
}
Just wrote and tested it, should work

This reads "sourcefile" line by line, checks if "contains" occurs in the line (e.g. CreateObject) and puts all those lines in "targetfile". It returns the number of lines that were copied. Both files have to exist of course, or it wont work.
Re: Is this possible? or how can I -
Jay. - 14.05.2011
Quote:
Originally Posted by Mauzen
No problem, its just some lines:
pawn Код:
stock ExtractLines(const conatins[], const sourcefile[], const targetfile[]) { new File:s = fopen(sourcefile), File:t = fopen(targetfile); new line[128]; new extracted; while(fread(s, line)) { if(strfind(line, contains, true) != -1) { fwrite(t, line); extracted++; } }
fclose(s); fclose(t); return extracted; }
Just wrote and tested it, should work 
This reads "sourcefile" line by line, checks if "contains" occurs in the line (e.g. CreateObject) and puts all those lines in "targetfile". It returns the number of lines that were copied. Both files have to exist of course, or it wont work.
|
Sorry for the late response I went to bed, it was late here
But, wow! Thanks alot, I just have one question now. where do I put them? (I really am no pro) but know quite alot.
Thanks
EDIT: or maybe I just put it in my script choose the line and compile and it will automatically select them all ?
Re: Is this possible? or how can I -
Mauzen - 14.05.2011
Just put it somewhere in the script and call the function at OnGameModeInit
e.g.
ExtractLines("CreateObject", "gamemode.pwn", "lines.txt");
And oh right, you have o copy your script with the lines to your scriptfiles folder, otherwise samp cant read it.