0.4.2.0 build 258
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

0.4.2.0 build 258

Started by PPK, 14 September, 2011, 00:19:33

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PPK

Windows x86/x64 version with GUI: http://www.ptokax.org/files/0.4.2.0b258.7z
Windows x86/x64 service: http://www.ptokax.org/files/0.4.2.0b258-service.7z
Source is in SVN

Quote from: Changes from build 241
Added: Core.SetUserInfo call to Lua api.
Added: IDs 28 - 42 for Core.GetUserValue Lua api call.

This version allow changes in MyINFO parts from Lua, for that MyINFO processing was little changed.
PtokaX now instead of full/original and stripped MyINFO have long (replacing full/original) and short (replacing stripped) MyINFO.
From Lua is possible to change in both MyINFOs: Description, Tag, Connection, Email and ShareSize.

New function was added for that:
Core.SetUserInfo(tUser, nValueId, nil/sValue/nValue, bPermanent)


tUser - Same table user as in many other api calls.
nValueId - Numeric indicator for MyINFO part to change.
nil/sValue/nValue - Use nil to remove change. Use string to change string value. Use number to change numeric value.
bPermanent - Boolean to make change permanent. When change is permanent then all next MyINFOs will contain that change.

IDs for nValueId:
Quote
0 - DescriptionShort
1 - DescriptionLong
2 - TagShort
3 - TagLong
4 - ConnectionShort
5 - ConnectionLong
6 - EmailShort
7 - EmailLong
8 - ShareSizeShort
9 - ShareSizeLong

New user data IDs for Core.GetUserValue:
Quote
28 - bDescriptionChanged
29 - bTagChanged
30 - bConnectionChanged
31 - bEmailChanged
32 - bShareChanged
33 - sScriptedDescriptionShort
34 - sScriptedDescriptionLong
35 - sScriptedTagShort
36 - sScriptedTagLong
37 - sScriptedConnectionShort
38 - sScriptedConnectionLong
39 - sScriptedEmailShort
40 - sScriptedEmailLong
41 - iScriptediShareSizeShort
42 - iScriptediShareSizeLong

IDs 28 - 32 can be used to check if MyINFO part was changed by user in last received MyINFO.
IDs 33 - 42 can be used by scripts to check if other script changed MyINFO part or to check own previous change.

And to show how it is working here is example script to add user country code to user description in short MyINFO:
Code: Lua
function OnStartup()
   if Core.BuildNumber == nil or Core.BuildNumber < 258 then
      curScript = ScriptMan.GetScript()
      ScriptMan.StopScript(curScript.sName)
      error("This script require PtokaX 0.4.2.0 build 258 or higher!")
   end
end

function AddCountryCode(tUser)
   sCountryCode = IP2Country.GetCountryCode(tUser.sIP)
   if sCountryCode ~= nil and sCountryCode ~= "??" then
      if SetMan.GetBool(13) == true then -- 13 is Strip user description
         Core.SetUserInfo(tUser, 0, sCountryCode, true) -- 0 is sScriptedDescriptionShort
      else
         Core.SetUserInfo(tUser, 0, sCountryCode.." "..Core.GetUserValue(tUser, 2), true) -- 0 is sScriptedDescriptionShort, 2 is sDescription
      end
   end
end

function OpConnected(tUser)
   AddCountryCode(tUser)
end

function RegConnected(tUser)
   AddCountryCode(tUser)
end

function UserConnected(tUser)
   AddCountryCode(tUser)
end

function MyINFOArrival(tUser, sData)
   if Core.GetUserValue(tUser, 9) == false then -- 9 is bConnected
      return
   end

   if Core.GetUserValue(tUser, 28) == true then -- 28 is bDescriptionChanged
      AddCountryCode(tUser)
   end
end


Result as user see it in client http://www.ptokax.org/files/images/CCinDescriptionByScript.png  8)

Have fun!  ;D
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Dessamator

Hi PPK, it seems from that description that it is possible to change everything except the user's name/nick. Is there any way to do so??
Ignorance is Bliss.

PPK

Nick can't be changed, it will confuse client because he will not see yourself in userlist when you change nick... and will be not able to login correctly  ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Dessamator

I was planning to convert to the latest PX the awayer script by herodes, it changes the nick to have a tag which shows if a user is away. Before he used a method where he would send "quit" to the original nick and show a nick with a tag.

I thought the new PX made it easier seems like it will still use the "messy" method.

Thanks anyway.

Ignorance is Bliss.

PPK

Away is handled by protocol and working good, of course when client don't ignore that part of nmdc protocol (so it is not in dc++, but it is in most mods)  ::) So i'm actually don't see why script like that is needed...
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Hamachi

Hey i have try make a script to hide op share, but it down work!

Some there can help me ?

I use dev 316

OnError = send msg to all crew

QuoteOpConnected = function(tUser)
   if Core.SetUserInfo(tUser, 16, 0, true) then
   OnError(2)
   end
   
   if Core.BuildNumber == nil then
      OnError(Core.BuildNumber)
   end
end

MyINFOArrival = function(tUser, sData)
   if Core.GetUserValue(tUser, 9) == false then
      return
   end

   if Core.SetUserInfo(tUser, 16, 0, true) then
   OnError(1)
   end
end

Psycho_Chihuahua

To hide share would be much easier by not sharing than using a script which would probably end up in higher bandwidth usage
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

PPK

Quote from: Hamachi on 16 February, 2012, 18:46:41
Some there can help me ?
Core.SetUserInfo have max nValueId 9... and you are using 16 ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Hamachi

Quote from: PPK on 16 February, 2012, 22:51:14
Core.SetUserInfo have max nValueId 9... and you are using 16 ::)

Ahh LOL

8 - ShareSizeShort
9 - ShareSizeLong

:)

SMF spam blocked by CleanTalk