PtokaX forum

Development Section => LUA & PtokaX-Scripting-Interface => Topic started by: NightLitch on 01 March, 2005, 12:50:50

Title: Lua Converter ( with GUI )
Post by: NightLitch on 01 March, 2005, 12:50:50
here you all go if you have trouble converting...

this is built with plops converter code, I just built a wxLua GUI.

Lua4 to Lua5 Converter (http://swenorth.myftp.org/network/nightlitch/Download/LuaConverter.rar)

msvcr70.dll (http://www.dll-files.com/dllindex/download.php?msvcr70download0UMlU0cGgX)

NOTE: file handlings is not converted....

(http://swenorth.myftp.org/network/nightlitch/converter.jpg)


*Changed*

GUI is updated.

- Fixed so even space strfind and strind( is changed ex.


Enjoy!!!
Title:
Post by: nEgativE on 01 March, 2005, 12:54:39
Oh God, thank U Night ..
Title:
Post by: blackwings on 01 March, 2005, 17:18:40
NL, do you know a safe source to download the "MSVCR70.dll" file?
Title:
Post by: ARCHANGEL on 01 March, 2005, 17:22:48
http://www.dll-files.com/
Title:
Post by: blackwings on 01 March, 2005, 17:41:02
the converter is great, but still you need to change the DataArrival() into whatever is needed + code that need to be devided among the new Arrivals.
Title:
Post by: NightLitch on 01 March, 2005, 18:47:51
QuoteOriginally posted by blackwings
the converter is great, but still you need to change the DataArrival() into whatever is needed + code that need to be devided among the new Arrivals.

As I said this is just a simple GUI with plops converter inbuilt to make it easier to some...

But I will try when I have time maybe extend the converter a little bit more...

And divide DataArrival is hard because there is so many diff. way ppl. program the data arrival everyone has its own way.

I might fix the file handling with a little help from plop, with others that can help me.
Title:
Post by: Tw?sT?d-d?v on 01 March, 2005, 19:47:31
can some1 help me with this error plz  

697: attempt to call global `read' (a nil value)
Title:
Post by: bastya_elvtars on 01 March, 2005, 21:06:44
QuoteOriginally posted by (uk)jay
can some1 help me with this error plz  

697: attempt to call global `read' (a nil value)

typical file-handler related error
Title:
Post by: bastya_elvtars on 01 March, 2005, 21:19:04
Seems like a BUG to me, sorry to be the first to report. ;)

From:

if user.sMyInfoString and strlen (user.sMyInfoString) > (strlen(user.sName)+13) then
To:

if user.sMyInfoString and strlen (user.sMyInfoString) > (string.len(user.sName)+13) then
btw very nice little tool, only thing i WOULD WELCOME is an Exit button when the 'Conversion finished' dialog comes up.
Title:
Post by: NightLitch on 01 March, 2005, 22:07:25
thx will look into it, and I will add an Exit button...
Title:
Post by: plop on 02 March, 2005, 00:09:30
damn cool boy.
it's gone be a real tuff job 2 convert scripts 2 the new arrivals.
gotta think a lot because i have no idea yet on how do to this.

plop
Title:
Post by: blackwings on 02 March, 2005, 04:29:27
QuoteOriginally posted by plop
damn cool boy.
it's gone be a real tuff job 2 convert scripts 2 the new arrivals.
gotta think a lot because i have no idea yet on how do to this.

plop
NL,plop & Mutor, this is just a simple idea that might help you guys to solve the problem
with DataArrival() convertion(even if my idea might not work) = 01) The converter begins wit searching for smaller parts in the DataArrival().
   (from line 3 in the DataArrival)
02) It finds $To: (saves in memory which line it is)
03) it counts the "if"&"for" from the line it finds $To: until it comes
   to a line with "end"(counts max 1 "if"&"for" per line)
04) Then it counts the "end's" from the when found in "3)" to match the number of "if"&"for" in "3)"
05) Saves in memory which line it found the last "end" counted in "4)"
06) It cuts out those lines an put them inside of a ToArrival().
07) deletes the empty lines in the DataArrival().
08) Makes again a search for things that should be put in seperate Arrival's.(again starts from line 3)
09) When it does find anymore code that should have their own Arrival, it checks line 2.
10) If it found something that identify which the remaining code should go to, it change line 1
    into the proper Arrival.
11) If it doesn't found anything on line 2, then it search for example this =
    Search for this = if,strfind,data  and find this on a single line =
    if( strfind(data, advDetect,1,1) ) then
12) changes line 1 into function ChatArrival()
13) If the DataArrival() doesn't follow this pattern, the convertion won't be made
    (like it found "end" at a line with "if"&"for")
Title:
Post by: NightLitch on 02 March, 2005, 09:29:26
It is a good idea Blackwing, but in my eyes amd maybe plops time consuming to even try, because ppl. have build their arrivals in different ways...
Title:
Post by: bastya_elvtars on 02 March, 2005, 12:37:51
Most scripts have their DataArrival strsub-ed, so they use:

function DataArrival(user,data)

if strsub(data, 1, 13) == "$ValidateNick" and checknick==1 then >> [color=#FF0000]ValidateNickArrival[/color]
elseif strsub(data, 1, 8) == "$GetINFO" and not user.bOperator then >> [color=#FF0000]GetINFOArrival[/color]
elseif strsub(data, 1, 7) == "$MyINFO" then >> [color=#FF0000]MyINFOArrival[/color]
elseif strsub(data, 1, 7) == "$UserIP" then >> [color=#FF0000]UserIPArrival[/color]
elseif strsub(data, 1, 4) == "$To:" then >> [color=#FF0000]ToArrival[/color]
elseif(strsub(data, 1, 12) == "$OpForceMove") then >> [color=#FF0000]OpForceMoveArrival[/color]
elseif(strsub(data, 1, 5) == "$Kick") then >> [color=#FF0000]KickArrival[/color]
elseif strsub(data, 1, 1) == "<" then >> [color=#FF0000]ChatArrival[/color]

Now you just omit the DataArrival and convert the crap as i wrote. The whole damn thing would not take 5 mins. And manual conversion is the safest IMHO in cases like this.
Title:
Post by: NightLitch on 02 March, 2005, 19:06:22
I will make a try tomorrow or Friday when I might feeling better....

Going to have an operation on my feets tomorrow, so I guess I need to have my feets high so not to much blood is streaming... heh...

But I'll be around...
Title:
Post by: bastya_elvtars on 02 March, 2005, 19:20:12
QuoteOriginally posted by NightLitch
I will make a try tomorrow or Friday when I might feeling better....

Going to have an operation on my feets tomorrow, so I guess I need to have my feets high so not to much blood is streaming... heh...

But I'll be around...

This was intended for blackwings... ;P
Title:
Post by: kepp on 05 March, 2005, 16:26:03
Nice work NL, maybe some improvements can be done

function UpdateLogs()
   --// Code --\\
end

Turns out

function Upos.dateLogs()
   --// Code --\\
end

Same goes for comments
Title:
Post by: bastya_elvtars on 05 March, 2005, 16:56:30
Yes, and substance goes to subsmath.tance.  :D
Title:
Post by: NightLitch on 05 March, 2005, 17:15:38
QuoteOriginally posted by kepp
Nice work NL, maybe some improvements can be done

function UpdateLogs()
   --// Code --\\
end

Turns out

function Upos.dateLogs()
   --// Code --\\
end

Same goes for comments

sure Am on it
Title:
Post by: NightLitch on 05 March, 2005, 19:44:11
*** Converter Updated ***

- Added simple converter for reading files converter
- Fixed errors in code when changing word inside a word

*** Download (http://swenorth.myftp.org/network/nightlitch/Download/LuaConverter.rar) ***
Title:
Post by: Mardeg on 11 March, 2005, 20:49:31
In --commented lines words like "format" and "remove" were changed to "string.format" and "os.remove". Comments should be exempt from conversion, no?

Inside "" strings, "A Mardeg script" was changed to "A Marmath.deg script". Fixable?

In a variable declaration:
  leechlog = "path/to/leecher.log"
was changed to
  leechmath.log = "path/to/leecher.log"
Title:
Post by: NightLitch on 11 March, 2005, 20:52:31
Thx will look deeper, but have you tried the newest or the old one ???

thought I had fixed that ??

-- comments and "strings" I can look into more... When I get the time...
Title:
Post by: Mardeg on 12 March, 2005, 10:55:52
I used the download link in your post above.
Also noticed it missed changing write( to io.write(
and t.remove changed to tos.remove instead of table.remove
It's still a great tool though :)
Title:
Post by: BeeR on 13 March, 2005, 15:52:03
HI alles :]
did try to convert my bots and gets this result:
attempt to perform arithmetic on global `min' (a nil value)

any ide ?? i guess it has something to do with the timer
--> StartTimer() <--
Title: hello everyone
Post by: LiqUiD~TrolL on 15 March, 2005, 17:12:59
good day my mates well i ve used this converter and i added the scripts in ptoka x


but something is wrong here is my message in the ptoka x   :

No syntax errors in script file AnTiFlooD By PloP_(4.5.4).lua5.lua
No syntax errors in script file modem_(no_slow_connections allowed).lua5.lua
No syntax errors in script file plop2_(6txt files).lua5.lua
No syntax errors in script file random_intro_outro.lua5.lua
Syntax ...emp\Rar$EX07.765\scripts\redirectprotection.lua5.lua:63: attempt to index global `checkAdmath' (a nil value)
No syntax errors in script file Release_Bot1 plop 3.2_(VIPS can add releases).lua5.lua
No syntax errors in script file RoboCopv10.01.lua
No syntax errors in script file zRightClicker.lua
Syntax ...lease_Bot1 plop 3.2_(VIPS can add releases).lua5.lua:221: attempt to call global `readfrom' (a nil value)
Syntax ...$EX07.765\scripts\AnTiFlooD By PloP_(4.5.4).lua5.lua:167: attempt to call method `EnableFullData' (a nil value)
Title:
Post by: Herodes on 15 March, 2005, 17:27:55
Take away deflood.lua ... it comes in-built within PtokaX nowadays ;)

the error on the ReleaseBot you have there is predictable because this as well as no other converter will be able to convert the code used for storing and reading data in files...

For a ReleaseBot look under the Lua 5 part of the board there are fulfilled requests already ...

recently ( today ) there is a Random-Intro-Outro script under the above-mentioned part of the board .. .
Title: hello herodes
Post by: LiqUiD~TrolL on 15 March, 2005, 18:13:00
=)
  once again, ok that was great tip
don t use the deflood, lees memory =)
haahha

and i ve fixed the releases script i found a link in the forum =)

but now i need plops help for showing some text files i want in my hub. any ideas for this?

i have 3-4 text files i wanna display in users
Title:
Post by: Herodes on 15 March, 2005, 18:21:26
QuoteOriginally posted by LiqUiD~TrolL
i have 3-4 text files i wanna display in users
'Enable text files support' checkbox under 'Options' tab in PtokaX gui... then put those files in the 'texts' folder that can be found next to 'PtokaX.exe' ... ( there is another checkbox through which you can decide whether to sent them in PM to the users ...
Title:
Post by: NightLitch on 15 March, 2005, 19:04:22
I will probobly not continue this project because it is to hard to convert a hole script....

some ppl. program ex.

strfind like this 2 ex:

strfind(data, "(%S+)")

and some

strfind ( data , "(%S+" )

the spaces is trouble in this case....

But I will not give up entierly, but we'll see....

//NL
Title: heya Herodes
Post by: LiqUiD~TrolL on 15 March, 2005, 19:19:07
m8 i knew this thing

but i wanted to change the perfix , in ptoka x it works only with ! and i wanted to change it into +

but anyway i made my work now and everything is fine


andone who know a link in the forum to get a good random intro outro  in LUA 5 ?????
Title:
Post by: Herodes on 15 March, 2005, 21:45:48
Stop hi-jacking this thread ... ;)
Title:
Post by: bastya_elvtars on 16 March, 2005, 04:21:16
QuoteOriginally posted by NightLitch

strfind(data, "(%S+)")

and some

strfind ( data , "(%S+"

string.find("strfind%s*%(") Isn't this good enough?
Title:
Post by: B@B? on 12 May, 2005, 19:39:45
QuoteOriginally posted by NightLitch
I will probobly not continue this project because it is to hard to convert a hole script....
//NL

Dear NightLitch

Please! Do so...  ;(

If i convert my older Scripts (for Lua 4) with this one i?ll have sometimes mistakes in there-  like this:

Syntax :457: unexpected symbol near `%'

The prob is:

Only the good scripts wich ? need makes errors like this...*grrrrrr*  X(

I hope, you?ll go ahead with this tool quickly;

I NEED IT and so I NEED YOU!  :rolleyes:
Title:
Post by: jiten on 12 May, 2005, 19:57:13
QuoteOriginally posted by B@B?
QuoteOriginally posted by NightLitch
I will probobly not continue this project because it is to hard to convert a hole script....
//NL

Dear NightLitch

Please! Do so...  ;(

If i convert my older Scripts (for Lua 4) with this one i?ll have sometimes mistakes in there-  like this:

Syntax C:\HUB\PTOKax 0.3.3.0\scripts\Connect 4.lua:457: unexpected symbol near `%'

or Neal...

The prob is:

Only the good scripts wich ? need makes errors like this...*grrrrrr*  X(

I hope, you?ll go ahead with this tool quickly;

I NEED IT and so I NEED YOU!  :rolleyes:
If this kind of error happens, just open the .lua file (e.g. with notepad), go to that line and remove the "%" from it. It'll be gone after that.

Cheers
Title:
Post by: B@B? on 13 May, 2005, 10:23:59
THX! @ jiten!  ;)

That was an successful way...

Maybe you know another?

:48: attempt to concatenate global `bot' (a nil value)  ?(

(also converted by the converter...)

...in front of... Thx
Title:
Post by: Dessamator on 13 May, 2005, 11:18:53
QuoteOriginally posted by B@B€
THX! @ jiten!  ;)

That was an successful way...

Maybe you know another?

:48: attempt to concatenate global `bot' (a nil value)  ?(

(also converted by the converter...)

...in front of... Thx

well i doubt he'll know how to fix that without u showing him the entire script, btw, if u do think of doing so do it in  the appropriate thread !
Title:
Post by: B@B? on 13 May, 2005, 11:56:41
Sorry Dessamator

That?s right, of cause.

I thougt i can write it in here cause of
it happend by an mistake after convertin...

Had posted an new one.  ;)
Title:
Post by: Dessamator on 13 May, 2005, 13:12:30
QuoteOriginally posted by B@B€
Sorry Dessamator

That?s right, of cause.

I thougt i can write it in here cause of
it happend by an mistake after convertin...

Had posted an new one.  ;)
no probs, at least u learnt,:)
Title:
Post by: Markitos on 01 September, 2005, 18:19:10
Hi!
Im trying to download the converter but the link's dead...Could some one give me another link or send me by mail???



Respectfully
Title:
Post by: Leun on 01 September, 2005, 19:29:42
Hi Markitos,

try this link: http://xpojnt.kotatka.cz/download/ostatni/LuaConverter_DCinfo.insecure.lv.zip

greetz
Title:
Post by: Markitos on 01 September, 2005, 20:32:13
QuoteOriginally posted by Leun
Hi Markitos,

try this link: http://xpojnt.kotatka.cz/download/ostatni/LuaConverter_DCinfo.insecure.lv.zip

greetz
Thnks!