HELP FOR FASTER WRITE IN PAWNO
#1

#define MAX_OBJECT 100
static Object[MAX_OBJECT];

and for example...

Код HTML:
CreateObject(12805, -1073.17, -730.09, 45.10,   0.00, 0.00, 0.50);
CreateObject(13198, -1009.79, -737.51, 36.09,   0.00, 0.00, 0.00);
CreateObject(17019, -1097.86, -599.76, 36.91,   0.00, 0.00, 0.00);
CreateObject(17019, -1077.68, -599.82, 36.93,   0.00, 0.00, 0.00);
CreateObject(12934, -1101.30, -625.07, 34.32,   0.00, 0.00, 0.00);
CreateObject(12934, -1101.19, -637.77, 34.32,   0.00, 0.00, 0.00);
CreateObject(12934, -1101.73, -685.37, 34.32,   0.00, 0.00, 0.00);
CreateObject(3627, -982.00, -666.96, 33.46,   0.00, 0.00, 0.00);
CreateObject(3578, -988.13, -676.83, 30.28,   0.00, 0.00, 90.00);
CreateObject(3578, -988.13, -667.00, 30.28,   0.00, 0.00, 90.00);
i want to do all like this

Код HTML:
Object[1] = CreateObject(12805, -1073.17, -730.09, 45.10,   0.00, 0.00, 0.50);
Object[2] = CreateObject(13198, -1009.79, -737.51, 36.09,   0.00, 0.00, 0.00);
CreateObject(17019, -1097.86, -599.76, 36.91,   0.00, 0.00, 0.00);
CreateObject(17019, -1077.68, -599.82, 36.93,   0.00, 0.00, 0.00);
CreateObject(12934, -1101.30, -625.07, 34.32,   0.00, 0.00, 0.00);
CreateObject(12934, -1101.19, -637.77, 34.32,   0.00, 0.00, 0.00);
CreateObject(12934, -1101.73, -685.37, 34.32,   0.00, 0.00, 0.00);
CreateObject(3627, -982.00, -666.96, 33.46,   0.00, 0.00, 0.00);
CreateObject(3578, -988.13, -676.83, 30.28,   0.00, 0.00, 90.00);
CreateObject(3578, -988.13, -667.00, 30.28,   0.00, 0.00, 90.00);
CreateObject(3578, -988.13, -656.32, 30.28,   0.00, 0.00, 90.00);
But how can I do, that the "object [number] =" appear in each line automaticaly, because I have 3000 objects and it really piss me off to write in each line "object [number] ="...
Reply
#2

Use Notpad ++ press Ctrl + H and Replace all. + rep if helped
Reply
#3

Regex functionality in Notepad++ can do it, indeed. A few step by step instructions:
  1. Copy all your CreateObject lines to Notepad++
  2. Select them all with CTRL-A
  3. Put your cursor at the very beginning
  4. Go to TextFX > TextFX Tools > Insert Line Numbers
  5. Press CTRL-H to open the Replace dialog and make sure the Regular Expression option is selected
  6. In the search box, type:
    Код:
    ([0-9]+) CreateObject
    In the Replace box, type:
    Код:
    Object[$1] = CreateObject
    Click Replace All
  7. Now, to get rid of the leading zeros (optional):
    In the Search box, type:
    Код:
    \[0+
    In the Replace box, type:
    Код:
    [
    Click Replace All
Edit: I just found out that there is actually an even easier way to do it in Notepad++, without the need to use regular expressions. Use search and replace to insert "Object[0] = " in front of every line. Then hold ALT and select all the numbers vertically. Then press ALT-C (or go to Edit > Column Editor). It should look like this (sorry, it's in Dutch):

Reply
#4

So i can use notepad++ like pawn? Does notepad++ compile files for samp??
Reply
#5

Quote:
Originally Posted by Supermaxultraswag
Посмотреть сообщение
So i can use notepad++ like pawn? Does notepad++ compile files for samp??
no, not quite...
what they are doing with notepad++ is just convert your code to the code you wish, as it provides that function. after you've done what they said with notepad++ you have to copy everything from notepad++ and paste it into pawno again and then compile it...

Although you ofc can use notepad++ the same way as you can do with pawno. You can write the code into it and you can save it as a .pwn file. Although notepad++ has no compiler to compile the .pwn file to the .amx file your server needs to run.
I'm pretty sure I've seen some extension or plugin or whatsoever for notepad++ once to add a compile function to it, but I'm not sure...
Anyway, without changing some things in notepad++ (changes that are not like 2 clicks but require some good knowledge - if even possible), you can not compile your script with notepad++, which means you can not replace pawno completely with notepad++.



EDIT: Found where I read about the notepad++ compile feature... CLICK HERE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)