Просмотр полной версии : [Поиск] Конвертер .pwn to .tde
Быдлокодер
24.03.2016, 15:53
У кого есть такой конвертер ? Или как с готового текстдрава (.pwn) сделать .tde ? - формат IpleomaxTextDrawEditor
вот строка .tde
197.500000|118.250015|0.000000|0.812500|442.000000|0.000000|1|-1|1|65535|0|0|255|1|1|0|0|box|0|0.000000|0.000000|0.000000|0.000000|0|0
вот .pwn
PlayerData[playerid][pTextdraws][13] = CreatePlayerTextDraw(playerid, 209.000000, 159.000000, "_");
PlayerTextDrawBackgroundColor(playerid, PlayerData[playerid][pTextdraws][13], 255);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][13], 5);
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][13], 0.240000, -0.299999);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][13], -1);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawSetProportional(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][13], 52.000000, 51.000000);
PlayerTextDrawSetPreviewModel(playerid, PlayerData[playerid][pTextdraws][13], 98);
p.s это только пример
Попробуйте это (http://pro-pawn.ru/showthread.php?5603).
Быдлокодер
24.03.2016, 17:41
Попробуйте это (http://pro-pawn.ru/showthread.php?5603).
немного не понял, как в этом случае использовать эту ф-цию ?
Можно написать такой конвертер на Pawn: либо с помощью макросов (тогда финальную строку всё равно придётся формировать вручную), либо с помощью перехвата функций и записи нужных значений в переменные + формирование окончательной строки в самом конце, но всё это можно сделать только если разобраться в том, какие данные и в какой последовательности находятся в этой строке6
197.500000|118.250015|0.000000|0.812500|442.000000|0.000000|1|-1|1|65535|0|0|255|1|1|0|0|box|0|0.000000|0.000000|0.000000|0.000000|0|0
Я сам не так давно думал такой конвертер написать, но не было времени разбираться в финальных данных (за что и какой параметр отвечает в строке выше). Предоставь такую информацию и что-нибудь придумаем
Desulaid
24.03.2016, 20:12
Или можно использовать sscanf.
Или можно использовать sscanf.
Ну давай с помощью sscanf преврати вот это
PlayerData[playerid][pTextdraws][13] = CreatePlayerTextDraw(playerid, 209.000000, 159.000000, "_");
PlayerTextDrawBackgroundColor(playerid, PlayerData[playerid][pTextdraws][13], 255);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][13], 5);
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][13], 0.240000, -0.299999);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][13], -1);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawSetProportional(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][13], 52.000000, 51.000000);
PlayerTextDrawSetPreviewModel(playerid, PlayerData[playerid][pTextdraws][13], 98);
Вот в это
197.500000|118.250015|0.000000|0.812500|442.000000|0.000000|1|-1|1|65535|0|0|255|1|1|0|0|box|0|0.000000|0.000000|0.000000|0.000000|0|0
Удачи
Seregamil
24.03.2016, 21:56
Ну давай с помощью sscanf преврати вот это
PlayerData[playerid][pTextdraws][13] = CreatePlayerTextDraw(playerid, 209.000000, 159.000000, "_");
PlayerTextDrawBackgroundColor(playerid, PlayerData[playerid][pTextdraws][13], 255);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][13], 5);
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][13], 0.240000, -0.299999);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][13], -1);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawSetProportional(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][13], 52.000000, 51.000000);
PlayerTextDrawSetPreviewModel(playerid, PlayerData[playerid][pTextdraws][13], 98);
Вот в это
197.500000|118.250015|0.000000|0.812500|442.000000|0.000000|1|-1|1|65535|0|0|255|1|1|0|0|box|0|0.000000|0.000000|0.000000|0.000000|0|0
Удачи
Всё очень просто. Текстдрав и результат различны. Даже если пилить конвертер, то эти данные различны. На координаты посмотри.
Nash_Brigers
24.03.2016, 21:57
Всё очень просто. Текстдрав и результат различны. Даже если пилить конвертер, то эти данные различны. На координаты посмотри.Не различны они. Это просто автор первые попавшиеся скопировал.
Seregamil
24.03.2016, 22:09
Не различны они. Это просто автор первые попавшиеся скопировал.
Ща запилю на какашке. Часик погодите
Desulaid
24.03.2016, 22:32
Ну давай с помощью sscanf преврати вот это
PlayerData[playerid][pTextdraws][13] = CreatePlayerTextDraw(playerid, 209.000000, 159.000000, "_");
PlayerTextDrawBackgroundColor(playerid, PlayerData[playerid][pTextdraws][13], 255);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][13], 5);
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][13], 0.240000, -0.299999);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][13], -1);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawSetProportional(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][13], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][13], 0);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][13], 52.000000, 51.000000);
PlayerTextDrawSetPreviewModel(playerid, PlayerData[playerid][pTextdraws][13], 98);
Вот в это
197.500000|118.250015|0.000000|0.812500|442.000000|0.000000|1|-1|1|65535|0|0|255|1|1|0|0|box|0|0.000000|0.000000|0.000000|0.000000|0|0
Удачи
Я-то подумал, что наоборот... Я тупой просто :)
---
А что если создать массив глобальный, потом перехватить все такие функции и просто скрепить инфу в один массив?
Я-то подумал, что наоборот... Я тупой просто :)
---
А что если создать массив глобальный, потом перехватить все такие функции и просто скрепить инфу в один массив?
Я именно это и хотел. И даже только что почти написал код для перехвата текстдравов для игроков (осталось лишь написать вывод окончательного варианта в консоль и мне нужно было проверить что означает предпоследнее число. Из-за этого открыл другой файл, а потом закрыл все два Pawno -_-), но закрыл Pawno без сохранения -_- Если никто нормальных вариантов не выложит, завтра либо полноценный инклюд подготовлю, либо просто пример
Seregamil
24.03.2016, 23:02
Я именно это и хотел. И даже только что почти написал код для перехвата текстдравов для игроков (осталось лишь написать вывод окончательного варианта в консоль и мне нужно было проверить что означает предпоследнее число. Из-за этого открыл другой файл, а потом закрыл все два Pawno -_-), но закрыл Pawno без сохранения -_- Если никто нормальных вариантов не выложит, завтра либо полноценный инклюд подготовлю, либо просто пример
Да задрал. Я уже допиливаю на какашке прогу.
Seregamil
24.03.2016, 23:41
Я сделал.
http://i.imgur.com/iH3rI3c.png
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;
namespace ipleomax
{
class Program
{
public static string iPositionX = "0.000000";
public static string iPositionY = "0.000000";
public static string iLetterX = "0.000000";
public static string iLetterY = "0.000000";
public static string iTextX = "0.000000";
public static string iTextY = "0.000000";
public static string iAlignment = "0";
public static string iColor = "0";
public static string iUsebox = "0";
public static string iBoxcolor = "0";
public static string iShadow = "0";
public static string iOutline = "0";
public static string iBackgroundcolor = "0";
public static string iFont = "0";
public static string iProportion = "0";
public static string iSelectable = "0";
public static string iType = "0";
public static string iText = "0";
static void Main(string[] args)
{
Console.WriteLine("Enter path to file");
string path = Console.ReadLine();
using (StreamReader fRead = new StreamReader(path, Encoding.GetEncoding("windows-1251")))
{
using (StreamWriter fWrite = new StreamWriter(path + ".result", false))
{
string line = string.Empty;
Regex integer = new Regex(@"\b(\d+)|-\b(\d+)");
Regex doubles = new Regex(@"(?:\d{1,6})?(?:\.\d{1,6})|-(?:\d{1,6})?(?:\.\d{1,6})");
Regex quote = new Regex("\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"");
Regex bracket = new Regex(@"\(.+\)");
MatchCollection collection;
bool key = false;
while (!fRead.EndOfStream)
{
line = fRead.ReadLine();
if (line.Length == 0)
{
if (key == false)
continue;
string resultLine = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}",
iPositionX, iPositionY, iLetterX,
iLetterY, iTextX, iTextY,
iAlignment, iColor, iUsebox,
iBoxcolor, iShadow, iOutline,
iBackgroundcolor, iFont, iProportion,
iSelectable, iType, iText );
fWrite.WriteLine(resultLine);
Console.WriteLine(resultLine);
iPositionX = "0.000000";
iPositionY = "0.000000";
iLetterX = "0.000000";
iLetterY = "0.000000";
iTextX = "0.000000";
iTextY = "0.000000";
iAlignment = "0";
iColor = "0";
iUsebox = "0";
iBoxcolor = "0";
iShadow = "0";
iOutline = "0";
iBackgroundcolor = "0";
iFont = "0";
iProportion = "0";
iSelectable = "0";
iType = "0";
iText = "0";
key = false;
}
if (line.Contains("TextDrawCreate") || line.Contains("CreatePlayerTextDraw"))
{
key = true;
line = bracket.Match(line).Value;
iText = quote.Match(line).Value;
collection = doubles.Matches(line);
iPositionX = collection[0].Value;
iPositionY = collection[1].Value;
iType = ((line.Contains("playerid") ? "1" : "0"));
continue;
}
if (line.Contains("TextDrawLetterSize") || line.Contains("PlayerTextDrawLetterSize"))
{
line = bracket.Match(line).Value;
collection = doubles.Matches(line);
iLetterX = collection[0].Value;
iLetterY = collection[1].Value;
continue;
}
if (line.Contains("TextDrawTextSize") || line.Contains("PlayerTextDrawTextSize"))
{
line = bracket.Match(line).Value;
collection = doubles.Matches(line);
iTextX = collection[0].Value;
iTextY = collection[1].Value;
continue;
}
if (line.Contains("TextDrawAlignment") || line.Contains("PlayerTextDrawAlignment"))
{
line = bracket.Match(line).Value;
iAlignment = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawColor") || line.Contains("PlayerTextDrawColor"))
{
line = bracket.Match(line).Value;
iColor = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawUseBox") || line.Contains("PlayerTextDrawUseBox"))
{
line = bracket.Match(line).Value;
iUsebox = (line.Contains("true") ? "1" : "0");//integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawBoxColor") || line.Contains("PlayerTextDrawBoxColor"))
{
line = bracket.Match(line).Value;
iBoxcolor = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetShadow") || line.Contains("PlayerTextDrawSetShadow"))
{
line = bracket.Match(line).Value;
iShadow = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetOutline") || line.Contains("PlayerTextDrawSetOutline"))
{
line = bracket.Match(line).Value;
iOutline = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawBackgroundColor") || line.Contains("PlayerTextDrawBackgroundColor"))
{
line = bracket.Match(line).Value;
iBackgroundcolor = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawFont") || line.Contains("PlayerTextDrawFont"))
{
line = bracket.Match(line).Value;
iFont = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetProportional") || line.Contains("PlayerTextDrawSetProportional"))
{
line = bracket.Match(line).Value;
iProportion = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetSelectable") || line.Contains("PlayerTextDrawSetSelectable"))
{
line = bracket.Match(line).Value;
iSelectable = integer.Match(line).Value;
continue;
}
}
}
}
Console.Read();
}
}
}
http://rghost.ru/6hMRyPWqn
P.S. ацтаньте. 2 часа ночи. о коде не особо и думаю.
Я сделал.
http://i.imgur.com/iH3rI3c.png
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;
namespace ipleomax
{
class Program
{
public static string iPositionX = "0.000000";
public static string iPositionY = "0.000000";
public static string iLetterX = "0.000000";
public static string iLetterY = "0.000000";
public static string iTextX = "0.000000";
public static string iTextY = "0.000000";
public static string iAlignment = "0";
public static string iColor = "0";
public static string iUsebox = "0";
public static string iBoxcolor = "0";
public static string iShadow = "0";
public static string iOutline = "0";
public static string iBackgroundcolor = "0";
public static string iFont = "0";
public static string iProportion = "0";
public static string iSelectable = "0";
public static string iType = "0";
public static string iText = "0";
static void Main(string[] args)
{
Console.WriteLine("Enter path to file");
string path = Console.ReadLine();
using (StreamReader fRead = new StreamReader(path, Encoding.GetEncoding("windows-1251")))
{
using (StreamWriter fWrite = new StreamWriter(path + ".result", false))
{
string line = string.Empty;
Regex integer = new Regex(@"\b(\d+)|-\b(\d+)");
Regex doubles = new Regex(@"(?:\d{1,6})?(?:\.\d{1,6})|-(?:\d{1,6})?(?:\.\d{1,6})");
Regex quote = new Regex("\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"");
Regex bracket = new Regex(@"\(.+\)");
MatchCollection collection;
bool key = false;
while (!fRead.EndOfStream)
{
line = fRead.ReadLine();
if (line.Length == 0)
{
if (key == false)
continue;
string resultLine = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}",
iPositionX, iPositionY, iLetterX,
iLetterY, iTextX, iTextY,
iAlignment, iColor, iUsebox,
iBoxcolor, iShadow, iOutline,
iBackgroundcolor, iFont, iProportion,
iSelectable, iType, iText );
fWrite.WriteLine(resultLine);
Console.WriteLine(resultLine);
iPositionX = "0.000000";
iPositionY = "0.000000";
iLetterX = "0.000000";
iLetterY = "0.000000";
iTextX = "0.000000";
iTextY = "0.000000";
iAlignment = "0";
iColor = "0";
iUsebox = "0";
iBoxcolor = "0";
iShadow = "0";
iOutline = "0";
iBackgroundcolor = "0";
iFont = "0";
iProportion = "0";
iSelectable = "0";
iType = "0";
iText = "0";
key = false;
}
if (line.Contains("TextDrawCreate") || line.Contains("CreatePlayerTextDraw"))
{
key = true;
line = bracket.Match(line).Value;
iText = quote.Match(line).Value;
collection = doubles.Matches(line);
iPositionX = collection[0].Value;
iPositionY = collection[1].Value;
iType = ((line.Contains("playerid") ? "1" : "0"));
continue;
}
if (line.Contains("TextDrawLetterSize") || line.Contains("PlayerTextDrawLetterSize"))
{
line = bracket.Match(line).Value;
collection = doubles.Matches(line);
iLetterX = collection[0].Value;
iLetterY = collection[1].Value;
continue;
}
if (line.Contains("TextDrawTextSize") || line.Contains("PlayerTextDrawTextSize"))
{
line = bracket.Match(line).Value;
collection = doubles.Matches(line);
iTextX = collection[0].Value;
iTextY = collection[1].Value;
continue;
}
if (line.Contains("TextDrawAlignment") || line.Contains("PlayerTextDrawAlignment"))
{
line = bracket.Match(line).Value;
iAlignment = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawColor") || line.Contains("PlayerTextDrawColor"))
{
line = bracket.Match(line).Value;
iColor = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawUseBox") || line.Contains("PlayerTextDrawUseBox"))
{
line = bracket.Match(line).Value;
iUsebox = (line.Contains("true") ? "1" : "0");//integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawBoxColor") || line.Contains("PlayerTextDrawBoxColor"))
{
line = bracket.Match(line).Value;
iBoxcolor = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetShadow") || line.Contains("PlayerTextDrawSetShadow"))
{
line = bracket.Match(line).Value;
iShadow = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetOutline") || line.Contains("PlayerTextDrawSetOutline"))
{
line = bracket.Match(line).Value;
iOutline = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawBackgroundColor") || line.Contains("PlayerTextDrawBackgroundColor"))
{
line = bracket.Match(line).Value;
iBackgroundcolor = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawFont") || line.Contains("PlayerTextDrawFont"))
{
line = bracket.Match(line).Value;
iFont = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetProportional") || line.Contains("PlayerTextDrawSetProportional"))
{
line = bracket.Match(line).Value;
iProportion = integer.Match(line).Value;
continue;
}
if (line.Contains("TextDrawSetSelectable") || line.Contains("PlayerTextDrawSetSelectable"))
{
line = bracket.Match(line).Value;
iSelectable = integer.Match(line).Value;
continue;
}
}
}
}
Console.Read();
}
}
}
http://rghost.ru/6hMRyPWqn
P.S. ацтаньте. 2 часа ночи. о коде не особо и думаю.
Мог бы прикрутить автоматическую подстановку формата "pwn", если никакой формат не указан. А так же действие, когда указанного файла не найдёт (сейчас, как я понимаю, программу просто крашнет :с)
Seregamil
25.03.2016, 00:01
Мог бы прикрутить автоматическую подстановку формата "pwn", если никакой формат не указан. А так же действие, когда указанного файла не найдёт (сейчас, как я понимаю, программу просто крашнет :с)
Может мне за вами еще задницу подтереть?
Программа делает свою работу. Остальное меня не волнует. Кому надо - допилит под себя.
Может мне за вами еще задницу подтереть?
Программа делает свою работу. Остальное меня не волнует. Кому надо - допилит под себя.
Можешь и подтереть, я не против ;)
Ну так допилил бы её до приличного состояния и релизнул. Думаю, она бы нашла свою аудиторию, ибо многие текстдравы на Максе рисуют
Быдлокодер
25.03.2016, 00:08
Может мне за вами еще задницу подтереть?
Программа делает свою работу. Остальное меня не волнует. Кому надо - допилит под себя.
есть способ запустить эту программку на winXP x86 ?
Seregamil
25.03.2016, 06:46
Скачайте .net framework и поставьте sharpdevelop. Через него скомпилируйте консольное приложение с моим исходным кодом
$continue$
25.03.2016, 08:30
Сделал бы GUI что ли (простенький, но GUI) и тогда можно было бы использовать Windows API - OpenFileDialog (https://msdn.microsoft.com/ru-ru/library/61097ykx%28v=vs.110%29.aspx)
Может мне за вами еще задницу подтереть?
Программа делает свою работу. Остальное меня не волнует. Кому надо - допилит под себя.
Seregamil
25.03.2016, 19:25
Сделал бы GUI что ли (простенький, но GUI) и тогда можно было бы использовать Windows API - OpenFileDialog (https://msdn.microsoft.com/ru-ru/library/61097ykx%28v=vs.110%29.aspx)
Иди и делай. Мне это не нужно. Указал путь - получил результат. Всё.
Быдлокодер
26.03.2016, 00:37
Иди и делай. Мне это не нужно. Указал путь - получил результат. Всё.
как поставить обратный слеш ? скопировать в консоль ничего нельзя!
как поставить обратный слеш ? скопировать в консоль ничего нельзя!
https://www.google.ru/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=%D0%9A%D0%B0%D0%BA%20%D1%81%D0%BA%D0%BE%D0%BF%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C%20%D0%B2%20%D0%BA%D0%BE%D0%BD%D1%81%D0%BE%D0%BB%D1%8C
Seregamil
26.03.2016, 06:56
Открываешь приложение и переносишь туда твой пвн файл. Путь сам скопируется в консоль
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. Перевод: zCarot