This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

aaargh banging my head on the wall simple chanmode change an

Old posts that have not been replied to for several years.
Locked
N
Nitro_007

aaargh banging my head on the wall simple chanmode change an

Post by Nitro_007 »

If i get this to do something then it dont stop lol im looking to check chanmode +S then if it doesnt exist invoke it, if it does thern do nothing

some1 please point out what im not getting into my head

also cant understand why it insists on 3 timer enties

Code: Select all

set ssl_timer	  60 
set chan       "#xxx"
#set cur_mode      "S"
set new_mode      "+S"

timer $ssl_timer ssl_on

proc ssl_on {} {
  global chan ssl_timer new_mode
  timer $ssl_timer ssl_on
    if {![botisop $chan]} {continue}
    if {[string match "S" [lindex [getchanmode $chan] ] ] != 1} {
    pushmode $chan $new_mode
    flushmode $chan
    putlog "SSL: set +S on $chan"
    }
}

proc ssl_start {} {
  global ssl_timer
  timer $ssl_timer ssl_on
}
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

replace:

Code: Select all

if {[string match "S" [lindex [getchanmode $chan] ] ] != 1} {
with:

Code: Select all

{[string match "*S*" [getchanmode [strlwr $chan]]} {
Once the game is over, the king and the pawn go back in the same box.
N
Nitro_007

Post by Nitro_007 »

hmmm that just dont seem to work

your line without the "if" gives me invalid command and without the last "]" it gives me missing bracket in the console window

and when iv added them it does nothing, reguardless of whether chan is or isnt +S
the only way i can get action from the new line is by adding != 1 same place i added on my line, which seems to totally revoke the whole compare argument and leaves me exactly where i was before

it will either do nothing or it will not stop doing it.

i dont mind if i have to add a dummy command after ie putlog ""

and then use the else to go to my needed command

but iv tried this and also i get nowhere

really you should be able to place the != elsewere in the compare but it just dont work

sorry if i sound dumb but this is my 1st ever bash at tcl, apart from changing sum general settings in otherds scripts
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

invalid command name "strlwr" ?

make sure alltools.tcl is loaded
or do [string tolower $chan]
photon?
N
Nitro_007

Post by Nitro_007 »

spock wrote:invalid command name "strlwr" ?

make sure alltools.tcl is loaded
or do [string tolower $chan]
no without the "if" in front of the given line i get string as invalid command which i presumed would happen before i did the new line.
as if im correct string is a secondary command related to preceeding commands ie if

without the final closing bracket to the string compare query i get missing bracket,

which i alsio noticed before i did the new line.

however i did as coded above 1st to see

yes alltools is loaded its the 1st script in my scripts section full.conf

i take it with [string to lower $chan] you mean a line

set chan [string tolower $chan]

if so iv tried it. not sure where in the script it should go so i tested above the proc

within the proc body below line if {![botisop

and below all

oh and just to note iv changed "set chan "#bla" "
to set ssl_chan "#bla"

iv also tried set cur_mode "[string [getchanmode [strlwr $chan]"

and tried to use "$cur_mode" match "*S*" in the if statement but its insisting on having a command there even tho iv used "" and comparing to texts shud be permitted according to documentation.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

:oops: Oups, damn, forgot to put the if.. sorry about that. It should be something like:

Code: Select all

if {[string match "*S*" [getchanmode [strlwr $chan]]} {
Once the game is over, the king and the pawn go back in the same box.
N
Nitro_007

Post by Nitro_007 »

Code: Select all

if {[string match "*S*" [getchanmode [strlwr $chan]]]} {
           
           still missing one of these i think      ^
         its been added here but is not on  your line
anyway for sum strange reason its doing somethig today but it seems it dont care wether the chan is +S or not it pushes it anyway
whereas it wasnt doing jack last night, still it was late.

anyway i dont think its quite what i asked for tho the line definately pulls the channel modes out

im looking for how to do this

Code: Select all

if {[string DOESNTmatch "*S*" [getchanmode [strlwr $chan]]]} {
is what i really want so then it should pushmode as commanded ONLY when "+S" does not exist.
[/code]
N
Nitro_007

Post by Nitro_007 »

ok iv worked something out why i cant get this to work

by running the script this method

Code: Select all

set cur_mode     [getchanmode [strlwr $ssl_chan]]
and using this as the if statement

Code: Select all

if {["$cur_mode" == "+npstl *"]} {continue}
will give me an error, (because of the [] surrounding the compare) but it does show me the text

Code: Select all

[getchanmode [strlwr $ssl_chan]]
is pyulling in the console and "S" is never included (even when its on) meaning its not pulling the info i require from the channel itself, but its getting it from the eggdrops own chanmode enforce data.

how can i query the real chanmodes NOT the eggdrops enforce chanmode ??

once iv found that out this tcl should support any new channel modes that eggdrop itself does'nt, and as iv heard eggdrop may never support some modes this will be really useful to many people
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

if {["$cur_mode" == "+npstl *"]} {continue}
^^ this is wrong, [] is used to mark of that "this is a command", also you can't use wildcards "*" in simple == matching, you have to use something like

Code: Select all

if {[string match $cur_mode "+npstl *"]} {continue}
now... if the getchanmode command doesn't return all chanmodes set, make the bot send the MODE command to the server

Code: Select all

putserv "MODE $chan"
it will give you the list of chanmodes set, then you just have to use bind raw to catch the return msg and pull out the correct item... ie the chanmodes
Elen sila lúmenn' omentielvo
N
Nitro_007

Post by Nitro_007 »

[quote="Papillon"]

Code: Select all

if {["$cur_mode" == "+npstl *"]} {continue}
^^ this is wrong, [] is used to mark of that "this is a command", also you can't use wildcards "*" in simple == matching, you have to use something like

Code: Select all

if {[string match $cur_mode "+npstl *"]} {continue}
I know the [] = command but then the console shows the invalid command, which = the text the $cur_mode is getting, and I repeat that text does not include caps S the custom mode for ssl enforced channel even tho its ON. the text in the console will show

Code: Select all

"invalid command +npstl"
wheras when mode +S is also set it should read

Code: Select all

"invalid command +npsStl"
so 1 of 2 things is happenning

getchanmode does not pull from the channel its self but the loaded chanmodes in eggdrop memory for the particular chan, or theres a bug in getchanmode command and its filtering caps chanmodes out.
N
Nitro_007

Post by Nitro_007 »

now... if the getchanmode command doesn't return all chanmodes set, make the bot send the MODE command to the server

Code: Select all

putserv "MODE $chan"
it will give you the list of chanmodes set, then you just have to use bind raw to catch the return msg and pull out the correct item... ie the chanmodes[/quote]

ah didnt quite read all your msg proply ok well its not returning all set modes

putserv bit i understand

but what is bind raw
N
Nitro_007

Post by Nitro_007 »

RAW (stackable)

bind raw <flags> <keyword-mask> <proc>
procname <from> <keyword> <text>

Description: previous versions of Eggdrop required a special compile option to enable this binding, but it's now standard. The mask is checked against the keyword (either a numeric, like "368", or a keyword, like "PRIVMSG"). from will be the server name or the source user (depending on the keyword); flags are ignored. The order of the arguments is identical to the order that the IRC server sends to the bot. The pre-processing only splits it apart enough to determine the keyword. If the proc returns 1, Eggdrop will not process the line any further (this could cause your bot to behave oddly in some cases).

im really not sure on this bind raw buisness

the lines im recieving is

Code: Select all

[06:04] [@] irc-server.name.se 324 Botnick #xxx +sptinSl 8
[06:04] [@] irc-server.name.se 329 Botnick #xxx 1057019448
obviously im only interested in line "324"

so its ???

Code: Select all

bind raw  flags??? 324 

proc raw_modes irc.server.name.se 324 "+sptinSl *"
now im really lost :)
struggling with any bind calls includine a simple bind pub to create a public command to switch +S on.

flags are ignored losing me further :)
and i have 10 servers in my connect list, this surely will present me with further problems

and the last bit is a cause for concern :O
If the proc returns 1, Eggdrop will not process the line any further (this could cause your bot to behave oddly in some cases).
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind raw - 324 procname
proc procname {from key arg} {
  blablabla... code in here
}
Elen sila lúmenn' omentielvo
Locked