Author Topic: Move Script Up or Down in PtokaX  (Read 2966 times)

0 Members and 1 Guest are viewing this topic.

Offline speedX

  • Lord
  • ***
  • Posts: 437
  • Karma: +59/-19
Move Script Up or Down in PtokaX
« on: 03 January, 2008, 09:47:21 »
Hi, posting my first basic script in this forum. Please post your comments as well as problems/bugs regarding this script.

Code: [Select]
-- Move Script Up or Down in PtokaX [NEW API] [Strict] by speedX (04/01/08)
-- Version 1.0

-- Note:
-- Please Dont add .lua extension (the script automatically adds the extension)

tSettings = {
  -- Bot Name
sBot = SetMan.GetString(21),

-- Hub Name
sHubName = SetMan.GetString(0),

-- Rightclick: Enable = true, Disable = false
bRC = true,

-- Commands
sMoveDown = "movedown",
sMoveUp = "moveup",

-- 1 = Allow ; 0 = Don't Allow
Levels = {
        [-1] = 0,       -- Unregistered User
        [0] = 1,        -- Master
        [1] = 0,        -- Operator
        [2] = 0,        -- Vip
        [3] = 0,        -- Registered User
        }
            
}

function OnStartup()
        Core.RegBot(tSettings.sBot,"","",true)
end

ChatArrival = function(User,Data)
if tSettings.Levels[User.iProfile] == 1 then
local _,_,cmd,file = string.find(Data, "%b<>%s%p([^ ]+)%s*([^|]*)")
 file = string.lower(file)
 f = ""..file..".lua"
if cmd and (cmd == tSettings.sMoveUp) then
   ScriptMan.MoveUp(f)
Core.SendToNick(User.sNick,"<"..tSettings.sBot.."> "..f.." has been successfully Moved Up.")
return true
elseif cmd and (cmd == tSettings.sMoveDown) then
   ScriptMan.MoveDown(f)
Core.SendToNick(User.sNick,"<"..tSettings.sBot.."> "..f.." has been successfully Moved Down.")
return true
end
else
  Core.SendToNick(User.sNick,"<"..tSettings.sBot.."> You are not allowed to use this command.")
  return true
end
end

UserConnected = function(User)
if tSettings.Levels[User.iProfile] == 1 then
if tSettings.bRC then
Core.SendToNick(User.sNick,"$UserCommand 1 3 "..tSettings.sHubName.."\\Move Up Script$<%[mynick]> !moveup %[line:Script Name]&#124;")
    Core.SendToNick(User.sNick,"$UserCommand 1 3 "..tSettings.sHubName.."\\Move Down Script$<%[mynick]> !movedown %[line:Script Name]&#124;")
end
end
end
OpConnected = UserConnected
RegConnected = UserConnected
« Last Edit: 22 July, 2009, 18:31:17 by speedX »
Thanking You,

speedX

PtokaX forum

Move Script Up or Down in PtokaX
« on: 03 January, 2008, 09:47:21 »

Offline Yahoo

  • Triple Ace
  • **
  • Posts: 225
  • Karma: +32/-14
  • People Say "I Dont Know English"
    • Yahoo
Re: Move Script Up or Down in PtokaX
« Reply #1 on: 03 January, 2008, 12:20:43 »
great work  :D
"BoRN FIGhTEr"

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: Move Script Up or Down in PtokaX
« Reply #2 on: 03 January, 2008, 12:58:46 »
NewUserConnected should be UserConnected other than that, it looks okey =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: Move Script Up or Down in PtokaX
« Reply #3 on: 03 January, 2008, 14:06:54 »
Code: [Select]
Core.GetUserAllData(User)
You use this line in both UserConnected and in ChatArrival.
I'm not sure what you want with it, i guess you copied this from a script converted by Hungarista's converter ?  :P
Either way, it is useless in both functions.
Its purpose is to fill the User object table with all values, but the only value you use is iProfile which is always available in the table, therefor the call does nothing but increase script memory usage.

Otherwise looks pretty good  :)

Offline speedX

  • Lord
  • ***
  • Posts: 437
  • Karma: +59/-19
Re: Move Script Up or Down in PtokaX
« Reply #4 on: 03 January, 2008, 16:20:08 »
You use this line in both UserConnected and in ChatArrival.
I'm not sure what you want with it, i guess you copied this from a script converted by Hungarista's converter ?  :P
Either way, it is useless in both functions.
Its purpose is to fill the User object table with all values, but the only value you use is iProfile which is always available in the table, therefor the call does nothing but increase script memory usage.

Otherwise looks pretty good  :)

Done, actually I had seen tht in one of the scripts converted by Hungarista's Converter, so thought tht it might be necessary. Anyways I have edited the script.

Thank you Madman and CrazyGuy for your replies...
Thanking You,

speedX

Offline rediff

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Move Script Up or Down in PtokaX
« Reply #5 on: 03 January, 2008, 16:20:46 »
nice script speedx
congrats

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: Move Script Up or Down in PtokaX
« Reply #6 on: 30 October, 2008, 04:01:00 »
its a great script but i would love to have an option where in i can place the two command where ever i want on the rigght click
like
<hubname>\\<ur scriptname>\\<and the 2 option>

Offline speedX

  • Lord
  • ***
  • Posts: 437
  • Karma: +59/-19
Re: Move Script Up or Down in PtokaX
« Reply #7 on: 30 October, 2008, 06:42:05 »
its a great script but i would love to have an option where in i can place the two command where ever i want on the rigght click
like
<hubname>\\<ur scriptname>\\<and the 2 option>

It is already given in the script.

Code: [Select]
UserConnected = function(User)
if tSettings.Levels[User.iProfile] == 1 then
if tSettings.bRC then
Core.SendToNick(User.sNick,"$UserCommand 1 3 "..tSettings.sHubName.."\\Move Up Script$<%[mynick]> !moveup %[line:Script Name]&#124;")
    Core.SendToNick(User.sNick,"$UserCommand 1 3 "..tSettings.sHubName.."\\Move Down Script$<%[mynick]> !movedown %[line:Script Name]&#124;")
end
end
end
OpConnected = UserConnected
RegConnected = UserConnected
« Last Edit: 22 July, 2009, 18:32:42 by speedX »
Thanking You,

speedX

Offline ?StIfFLEr??

  • Triple Ace
  • **
  • Posts: 241
  • Karma: +17/-63
Re: Move Script Up or Down in PtokaX
« Reply #8 on: 30 October, 2008, 10:27:16 »
sorry i noticed it when i was reading the script....
forgot to update the forum
sorry for the trouble
its indeed a nice script atleast i wont have to use ptokax now again and again

PtokaX forum

Re: Move Script Up or Down in PtokaX
« Reply #8 on: 30 October, 2008, 10:27:16 »