Author Topic: Little help required with user commands  (Read 5419 times)

0 Members and 1 Guest are viewing this topic.

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Little help required with user commands
« on: 26 October, 2009, 09:02:10 »
Hey guys!!

i need some help w.r.t to user commands and some string manipulation!!

First the user command:

When i was learning how to send user command i got to know that we can send commands at 3 places ie hub tab, user list or search result. Is there any way that i can set a command in the file list. ie wen user browse some1 files list he can get those commands. I am asking this is because i have seen in ApexDc and StrongDC that we can add some commands in the file list too.

Next thing is with string:

i m developing a script where wen a user shares something he can use the command and the command will send all the hub users a notification that user abc has shared blah with path and size

for that this is how to user-command will look
Code: [Select]
$UserCommand 1 4 Trial Commands\\Add Share$<%[mynick]> +share %[file] %[filesizeshort] %[filesize] %[nick]&#124;
So the output of this will be the complete path of the file along with the file name, short size of the file, long form of file size and users nick.

something like this.

Code: [Select]
+share Movies\Promos\AVATAR HD.avi 35.83 MiB 7158103 ABC
how can i use a string function so that i can dismantle the data in following format

Code: [Select]
Path:Movies\Promos\
File Name: AVATAR HD.avi
File Size: 35.83 MiB
User: ABC

I had been trying from a long time by cant get it right :(

And one last thing

Can ne1 explain me the concept of ConnectToMeArrival() function. I know that when a users tries to get file list of other user this function is triggered. But what i want to know is how can we use the data that is passed when it is triggred, can we get wich user is that user is tryin to connect the file name the size etc etc.

Any help will be appreciated
thanks

Eyes says everything,
Its on you how u read em...

PtokaX forum

Little help required with user commands
« on: 26 October, 2009, 09:02:10 »

Offline the-master

  • Triple Ace
  • **
  • Posts: 229
  • Karma: +10/-15
Re: Little help required with user commands
« Reply #1 on: 26 October, 2009, 09:46:33 »
The Usercommands can be send anywhere, the codes are in the 1 1 part.
Try 1 15 and you will see them in all the places.
Its all depending on the second number u use, 1 1 is a place, 1 2 another, 1 3 are the places 1 1 and 1 2 together, 1 4 is again another place, 1 5 is 1 4 and 1 1 together, 1 6 is 1 4 and 1 2 together etc..
keep on sharing :)
dchub://kickincountryhub.no-ip.org

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #2 on: 26 October, 2009, 17:10:31 »
The Usercommands can be send anywhere, the codes are in the 1 1 part.
Try 1 15 and you will see them in all the places.
Its all depending on the second number u use, 1 1 is a place, 1 2 another, 1 3 are the places 1 1 and 1 2 together, 1 4 is again another place, 1 5 is 1 4 and 1 1 together, 1 6 is 1 4 and 1 2 together etc..
ya i know that buddy bt how do you set them to show only in file list.

Eyes says everything,
Its on you how u read em...

Offline the-master

  • Triple Ace
  • **
  • Posts: 229
  • Karma: +10/-15
Re: Little help required with user commands
« Reply #3 on: 26 October, 2009, 19:41:48 »
If you really knew what i was trying to tell you, you would know that "$UserCommand 1 8" shows in filelistmenu
keep on sharing :)
dchub://kickincountryhub.no-ip.org

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #4 on: 27 October, 2009, 08:04:27 »
If you really knew what i was trying to tell you, you would know that "$UserCommand 1 8" shows in filelistmenu
hehe thanx bt i figurd dat out bit late
See this thread on CG's Nighthawk Forum
It explains the parameters for UserCommands in greater detail
thanks buddy that was some good ref. I was lookin for your reply hey muter can you help me with the string and the connecttomearrival query. Thanks :)

Eyes says everything,
Its on you how u read em...

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: Little help required with user commands
« Reply #5 on: 27 October, 2009, 15:13:50 »
This is also on CG's forum....  CTM
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 satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #6 on: 27 October, 2009, 15:50:13 »
This is also on CG's forum....  CTM

Thanks buddy!! now with the String manipulation can u help me with that pleasee :D

thanks

Eyes says everything,
Its on you how u read em...

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: Little help required with user commands
« Reply #7 on: 28 October, 2009, 16:15:08 »
Code: [Select]
+share %[file] %[filesizeshort] %[filesize] %[nick]&#124;
local _,_,f,fss,fs,n = "share%s(.+)%s(%d+%a+)%s(%d+)%s(" ..user.sNick ")"

I don't know the client variabels, but i asume filesizeshort is 50MB and filesize is 500000...
so that's what i worked on. just use the pattern above in a string.find
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 satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #8 on: 28 October, 2009, 16:22:35 »
Code: [Select]
+share %[file] %[filesizeshort] %[filesize] %[nick]|
local _,_,f,fss,fs,n = "share%s(.+)%s(%d+%a+)%s(%d+)%s(" ..user.sNick ")"

I don't know the client variabels, but i asume filesizeshort is 50MB and filesize is 500000...
so that's what i worked on. just use the pattern above in a string.find

Thanks buddy will try that out and will let u know!! :)

thanks for the help buddy i was really needed this!!

Eyes says everything,
Its on you how u read em...

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #9 on: 29 October, 2009, 08:03:17 »
Fantastic mutor that really works!!

but there is a problem!!
the user-command that i m sending from the script to the users is something like this

Code: [Select]
$UserCommand 1 4 Trial Commands\\Add Share$<%[mynick]> +share %[file] %[filesizeshort] %[filesize] %[nick]&#124;
Now when users clicks on any file name and triggers this command the path along with the file name doesnt contain '\\' i contains only single slash!!

this is wat i mean

Code: [Select]
+share Movies\Promos\AVATAR HD.avi 35.83 MiB 7158103 ABC
This is how the data will be received by the hub. there wont bt \\ in the path name i hope u get what i m trying to say

but ur sample code was really very good thanks a lot for it can u pls help me out with that pls.


Eyes says everything,
Its on you how u read em...

Offline satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #10 on: 29 October, 2009, 09:20:24 »
Hey mutor thanks
using some of my logic and some help from your sample script i figured out the whole script!!

Thanks a TON man u are a great help..

Just one query,
This is also on CG's forum....  CTM

Here while reading i found that we can get to know that which user is trying to connect which.
But we i tried to display the data ie the data wich is passed as a arg to CTM it doesnt displays nething :(

can u tell me how to show the data of CTM in hub!!?? i mean do we hv to use string.format??


Eyes says everything,
Its on you how u read em...

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: Little help required with user commands
« Reply #11 on: 29 October, 2009, 14:34:28 »
Core.SendToAll("CTM: "..data)

if you just send data, it will "execute" the data as a CTM....
so adding anythign before data i.e "CTM: " or "!" will send it to main.
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 satya

  • Fulll Member
  • ****
  • Posts: 64
  • Karma: +3/-5
Re: Little help required with user commands
« Reply #12 on: 29 October, 2009, 15:22:12 »
Core.SendToAll("CTM: "..data)

if you just send data, it will "execute" the data as a CTM....
so adding anythign before data i.e "CTM: " or "!" will send it to main.

ohh ki lemme try that!! thanks madman!! :)

Eyes says everything,
Its on you how u read em...

PtokaX forum

Re: Little help required with user commands
« Reply #12 on: 29 October, 2009, 15:22:12 »