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.

Sugestion..

Old posts that have not been replied to for several years.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Any sugestin to split this:"something something this something".. the "this" word can be the 3-rd word or in any other position.. I just want to get that "this" from a line. Ex. "Mama has a cow. this a nice pig." can be like "This is a pig. mama has a cow." and I want to return only the "cow". :smile: Thx anyway..
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I'm tryng to split in fact this notice line: "Join this channel -> #channel #channel #channel".. etc. the "#channel" can be the 5-th argument or 6.. 7.. Any sugestion? One more clearly pls.. :smile:
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You have 3 #channel's there, which one do you want?
User avatar
Souperman
Halfop
Posts: 69
Joined: Sat Feb 02, 2002 8:00 pm
Location: Cape Town, South Africa
Contact:

Post by Souperman »

I don't have a clue what you're saying.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I'm tryng to get only 1 "#somelamechannel" from "a bunch of words for an advertise of a lame channel #somelamechannel #somelamechannel #somelamechannel #somelamechannel .. etc." in this can be more than 3 words, is an advertise and depends on the one who mades it.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Caesar,

Do you want to have the first occurence of a channelname from a string?
A channelname is found by testing the first character of each word in the string for the occurence of an "#"?
Or do you simply want to know if there was a channelname mentioned in the notice?
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Code: Select all

# on input a string, return #channel or 0
proc channeladvertise { string } {
   # does # occur at all?
   if {[string first "#" $string] == -1} { return 0 }
   # make a list and test first char of each element
   set list [split $string]
   foreach element $list {
      if {[string first "#" $element] == 0} {
         # note: also triggers if element is "#"
         return $element
      }
   }
   # nothing...
   return 0
}
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ok, thx. I got a other tcl.. let's see if you can give me an good sugestion on this two.

- Code -
# .next
set users ""

bind join * #chan next_join

proc next_join {nick host hand chan} {
global users
set users "$users $nick"
}

bind pub * .next next_cmd

proc next_cmd {nick uhost hand chan text} {
global users
set voice [lindex $users 0]
if {[onchan $voice $chan]} {
putserv "MODE $chan +v $voice"
next_chg
}
next_chg
}

proc next_chg { } {
set users ""
set voice [lindex $users 0]
}
- Code -

I need some help with:

-this -
proc next_chg { } {
set users
set voice [lindex $users 1]
- this -

I'm tryng to make: set users "" to take from the original $users and split that from the 2-th nick to the end. And I don't know what to put in { } at the proces. Any sugestions?


<font size=-1>[ This Message was edited by: caesar on 2002-02-07 12:13 ]</font>
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I think I "set voice [lindex $users 1]" is wrong.. this wants to split from all $users the first nick.
At the "set users something in here.." I'm tryng to split from the $users from the first nick to the end..
O well corect me if I'm wrong. I'll apreciate this. Thx!
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Caesar, Indeed there are a couple of suggestions:

1. there are three questions asked on the previous topic, which you left unanswered.

2. When changing the topic, open a new topic on the board.

Suggestions for your "new script":

3. The functionality you want seems close to what someone else (or your alter ego) wanted:
http://forum.egghelp.org/viewtopic.php? ... &forum=2&8

4. I've implement the above using your method of bookkeeping a list, and it is doable. But using a list, requires extensive bookkeeping.
Suppose a stray of 100 clones joins and parts your channel 20 times. Your variable $users will grow. The bookkeeping you need to do is on JOIN/PART/SIGN and maybe SPLT/REJN.

My suggestion is not to do it this way.

Check out:
http://www.geocities.com/eggheadtcl/angelina.tcl.txt
This script can be easily modified to bind to a MSG trigger. The putdcc can be replaced by puthelp NOTICEs.

Anyway, if you continue it your own way...

5. In your script you mix list and string.
For example you use: set users "$users $nick". If you want to keep a list use [lappend].
Suggestion: don't mix lists and strings. It will give you headegg.

6. Apart from testing for [onchan], check that the bot is op [botisop]. It doesn't make sense to serve +v if the bot isn't op.

7. If your bot is on more than 1 channel, you need to keep track of users on a channel by channel basis.

8. If you want to remove the first item from a list use the [lrange $list 1 end] or simply cut the first item from the list [lreplace $list 0 0]

9. Below your putserv, there is a "next_chg". It seems you must omit this one. Otherwise "next_chg" is called twice upon one .next command.

10. O yeah, for the bookkeeping part: NICK changes must also be tracked...

11. People with +o don't need to be voiced. Unless you are generous.

12. And more bookkeeping... people getting KICKed should also be tracked...

There is probably more, and there are prolly some errors in my message... but too big headegg now... (or is it a troll anyway? :smile:

<font size=-1>[ This Message was edited by: egghead on 2002-02-07 13:05 ]</font>
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Well.. here are my answers.

1) #chan is not the real name of channel, this is for the moment.
2) I want to extract from the $text only the name of the channel. To split that $text and make a variable with the name of the channel.
3) No I want to make a variable with his name, to use it.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Well.. I got this .next ideea for a channel that is leanding eggdrops, that is not my alter ego. I'm a boy not a girl. :smile: I'll use that [lappend] thing if I know much of this. Any link or something for this? I wasn't so sure about [lrange $users 1 end].. so that's wy I asked about this. Thx!
This .next thing is only for 1 channel.
A.. oups.. I forgot to remove that "next_chg", there was something more and I removed and forgot it. :smile:
Nick changes.. humm.. well.. I'll add that 2 and a chk of if that nick is a user. Well onest I got to do one for: kick/part/quit.. :smile: .. a bookkeeping..

Well I'll throw an eye on that tcl you made for that girl. I'll think if I'll continue with my tcl or I'll "update" for my needs. Thx!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Well.. Keep in touch and I'll keep in my mind your sugestions. :smile:
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Happy TCLing :smile: Enjoy!

<font size=-1>[ This Message was edited by: egghead on 2002-02-07 14:07 ]</font>
Locked