mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Hey guys

I've attempted coding this myself, using help from other bot creators, but I've had absolutely no joy at all.

I have tried the coding from Craftingmotion and this is not what I need, and I can't work out how this can be implemented into a gambling system or the like to use for giveaways and such.

In short, what I'm basically looking for, is a system, that will give a new follower 100 eggs to start. Whilst in the channel, whether online or offline, will gain eggs. They will gain 10 eggs every 10 minutes while I'm online, then 2 eggs per 10 minutes while I'm offline (If they leave the channel, then they will earn 0 eggs).

I would then like to have like I've seen in multiple channels, the chance to do something like a heist, but worded differently, as something I activate in the chat during the breaks. This gives the participants a chance to earn more eggs.

Also, I would like to add for the viewers a !roll command which would randomly choose a number between 1-20 to decide their fate. I would like to change the variables for each of the rolls, but the amounts that would be rolled would be determined on what they have as a percentage of their total eggs.

I would then also like to have a giveaway plugin, which would be set to 50 eggs per ticket, and when drawn, would select a value from the list of players who have entered.

I know this is alot of work, and I've not even got the foggiest where to start to code this, as the basic coding I've used so far, I've used from others, and just adjusted it to work with my bot. I can't find anything other than the coding from CraftingMotion, and this really doesn't help.

If you can help in any way shape or form (Even if it means getting the loyalty system working properly, that would be awesome)

-Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
I'm curious, I can see alot of people have viewed this, but have not responded. I'm really in a need for this, as I don't want to use an external bot to control this, when I can possibly code this into EggBot_v1

-Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Here's something I wrote, please consult the mIRC help file for commands you are not familiar with. You can customize it to your needs.

https://forums.mirc.com/ubbthreads.php/topics/256203/Re:_Point_system_lag#Post256203

Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
I can't seem to get this working, and be able to integrate this into the bot's gaming system at the moment. I need someone to code something from scratch if they can help, and I would possibly pay for this, as well as giving full credit for the system.

-Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
Well, I got bored enough to see how I'd write the script. You didn't properly explain how the heist or roll things should work, so I ignored them completely. The giveaway explanation was a bit lacking too, but I wrote it anyway.

To limit the channels where the script works, all you need to do is to change the join event:
on *:join:#: { = all channels.
on *:join:#mychannel,#theirchannel,#nooneschannel: { = Those three channels only.
Code:
on *:start:unset %eggsonline.*

on *:text:!ticket:#: {
  var %h = eggs. $+ #,%p $hget(%h,$nick),%w @eggs. $+ #
  if ($hget(%h)) {
    if (!$window(%w)) .notice $nick Giveaway is not active currently, so you can't buy tickets.
    elseif (%p >= 50) {
      hadd %h $nick $calc(%p -50)
      aline %w $nick
      .notice $nick Ticket bought! You now have $iif($fline(%w,$nick,0) == 1,1 ticket,$bytes($v1,b) tickets) and $iif($hget(%h,$nick) == 1,1 egg.,$bytes($v1,b) eggs.)
    }
    else .notice $nick You need more eggs to buy a ticket! You currently have %p $iif(%p == 1,egg.,eggs.)
  }
}

on *:text:!eggs:#: {
  var %h = eggs. $+ #,%w @eggs. $+ #
  if ($hget(%h)) {
    if ($window(%w)) .notice $nick You currently have $iif($hget(%h,$nick) == 1,1 egg,$bytes($v1,b) eggs) and $fline(%w,$nick,0) tickets in the giveaway.
    else .notice $nick You currently have $iif($hget(%h,$nick) == 1,1 egg.,$bytes($v1,b) eggs.)
  }
}

menu channel {
  -
  Egg options
  .$iif(%eggsonline. [ $+ [ # ] ],Go offline,Go online):$iif(%eggsonline. [ $+ [ # ] ],unset,set) %eggsonline. [ $+ [ # ] ] 1
  .-
  .$iif($window(@eggs. $+ #),Conclude the giveaway): {
    var %w = @eggs. $+ #,%t $line(%w,0)
    if (%t > 0) msg # Giveaway is over: the winner is $line(%w,$rand(1,%t)) $+ !
    else msg # Giveaway is over: not enough participants.
    window -c %w
  }
  .$iif(!$window(@eggs. $+ #),Start a giveaway): {
    window -h @eggs. $+ #
    msg # A giveaway has started! You can buy tickets by typing !TICKET for 50 eggs each.
  }
  .-
  .Give everyone eggs: {
    var %h = eggs. $+ #
    if ($input(How many eggs would you give to the eggheads of # $+ ?,buqe,Eggs,50) > 0) noop $hfind(%h,*,0,w,hinc %h $1 $v1)
  }
  -
}

on *:join:#: {
  var %h = eggs. $+ #
  if ($nick == $me) {
    hfree -w %h
    hmake %h 100
    .timereggs. $+ # 1 600 addeggs #
  }
  elseif ($hget(%h)) && ($hget(%h,$nick) == $null) hadd %h $nick 100
}

on *:part:#:if ($nick == $me) saveeggs #

on *:kick:#:if ($knick == $me) saveeggs #

on *:disconnect: {
  var %x = 1
  while ($chan(%x)) { saveeggs $v1 | inc %x }
}

alias -l saveeggs {
  var %h = eggs. $+ $1
  if ($hget(%h)) {
    hsave -i %h Eggs.db $1
    hfree -w %h
    .timereggs. $+ # off
  }
}

alias -l addeggs {
  var %x = 1,%h eggs. $+ $1,%p $iif(%eggsonline. [ $+ [ $1 ] ],10,2)
  if ($hget(%h)) {
    while ($nick($1,%x)) { hinc %h $nick($1,%x) %p | inc %x }
    hsave -i %h Eggs.db $1
  }
}

raw 366:*:checkforneweggs $2

alias -l checkforneweggs {
  var %h = eggs. $+ $1,%x 1
  if ($hget(%h)) {
    while ($nick($1,%x)) { if ($hget(%h,$nick($1,%x)) == $null) hadd %h $nick($1,%x) 100 | inc %x }
    hsave -i %h Eggs.db $1
  }
}


When you join a channel, it creates a hash table called "eggs.<CHANNEL>" and a timer called "eggs.<CHANNEL>". The timer executes "addeggs" alias once every 10 minutes, and gives everyone 2 or 10 "eggs," depending on your status.

To set your status to online/offline: open the channel menu --> Egg options --> Go online/offline. You can also start a giveaway or give eggs to everyone via that same menu.

The way the giveaway works is that it creates a hidden @window for the channel (@eggs.<CHANNEL>), and each time a user says "!TICKET" it adds their name to the window. So a person buying 10 tickets would have their name 10 times in the list, and the the script just does $rand(1,<number of lines>) and picks the winner. More names in the list = the higher chance to win.

There's also an "!EGGS" command that will show the user how many eggs (and tickets) they have.



It should be easy for anyone to extend the script to do whatever they want. Each channel gets "eggs.<CHANNEL>" hash table, item names in the hash table are user names and the item values are the number of eggs they have.

Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Omg Dazuz, you're awesome laugh

Okay, in explanation for the giveaways, the ticket side of things would be awesome, each ticket would be worth 50/150 eggs depending on what I set it to at the time, that would work awesomely as what you've coded.

For the roll side of things, it's more of a "Random Chance" thing. I've had some coding from a friend of mine that may help me do this, now the loyalty system is now working. Basically, players can roll a D20. Certain things on the rolls would do certain things. For example, if a viewer typed !roll, the bot would select a random number, and then would display a result of this roll. It could be good, could be bad. I just need a way, to be able to integrate this into the loyalty system, as I don't know how to deduct eggs from viewers or add them using a background command.

For the heist side of things, what I would love to have, would be every 15 mins, would become available. Now, once a player wants to heist, they bet a select amount of their eggs (Determined by the viewer) to battle in the heist. After 3 minutes, and enough players have entered, the heist would take place. It needs to be on a random chance again, but basically, everyone may survive, everyone may die, and some people may live, and die. If they die in the heist, they lose their eggs bet. If they win, depending on the amount of people entered, will give them at least 200x their bet, if not more. This is more complicated to explain, however, if you're wanting to chat with me to discuss this, I would be more than happy to pm you with my discord so we can talk smile

I also would love to know, as I think I could code both of them, is how to integrate that with the loyalty system, to be able to add and remove eggs on the fly as well for certain chatters, as instead of giving eggs to everyone, I may just want to select one person.

Once again, Thanks so much for your help so far, and you will be getting an announcement per stream for your help and coding smile

-Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Hey guys of the mIRC Forums!

Dazuz has coded this for me, but I'm drawing a blank here in relation to being able to add and remove points onto the database. I've been trying to code it, based on what's on the code, but nothing has been working, and I think the reason for this, is because of the fact I don't really understand the coding.

If anyone here that is watching the post, has any suggestions to get this working, so I can try it and test it, feel free to put it down in the thread, and if it works, I'd give you some credit for it in the coding of the bot.

-Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Your aliases (addeggs for example) have -l switch, which means "the alias becomes accessible only by commands in the same script and invisible to the command line and other scripts." (c) mIRC help. You can try removing this -l switch and experimenting with some incoming parameters (dont forget to make back up of your current data base).


Dont give a fish - teach to fish!
Joined: Sep 2013
Posts: 61
E
Babel fish
OP Offline
Babel fish
E
Joined: Sep 2013
Posts: 61
Yo Splinny,

I've been trying to use all of the mIRC help files, and even searches on the forums to find any relation to this code. The issue I've got with this, is that it's based on a .db file which I can't access.

I'm literally just scratching my head, as I don't understand what the parameters in the actual commands already written do.

I've been trying to code something into the bot around the "give everyone eggs" part of it, so that I could do it around an option on the mIRC channel window.

The only downside to coding the above, means that the code that I want to use for the games I've already coded still won't work, as I still don't know the code to be able to add or remove eggs as part of it.

I know that you are trying to help with the help files and the forums in searching, but I've spent the last 5 hours trying to code something into it, but nothing is working at all (I have since deleted it, as I know for a fact that it doesn't actually work, and is completely wrong) as I've been basing it on the code already written for me.

I'd love if Dazuz would reply and get the coding for me, as it would make life so much easier, as he's coded this from scratch for me, but if anyone else could try and write the code, as I've not got a clue lol, then it would be extremely appreciated.

-Eggy


Twitch Live-Streamer:
Synth Riders
Beat Saber
www.twitch.tv/eggfriedcheese
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
This is a bit late, but whatever.

The data is stored in a hash table(s), and each channel has its own hash table (eggs.CHANNELNAME). To change the amount of "eggs", all you need to do is to use the hash table commands.

/hadd eggs.#MyChannel RandomUser 500
Sets the number of eggs RandomUser has on #MyChannel to 500.

/hinc eggs.#MyChannel RandomUser 50
Increases the number of eggs RandomUser has on #MyChannel by 50.

/hdec eggs.#MyChannel RandomUser 250
Decreases the number of eggs RandomUser has on #MyChannel by 250.

/hdel eggs.#MyChannel RandomUser
Deletes the RandomUser's entry completely.

For more, check /help /hadd.



And here's the script with !roll:
Code:
menu nicklist {
  -
  Edit eggs: {
    var %h = eggs. $+ #
    if ($input(Enter the changed egg value for the user $qt($1) $+ :,buqe,Eggs,$iif($hget(%h,$1) isnum,$v1,0)) != $null) hadd %h $1 $v1
  }
  -
}

on *:text:!roll:#: {
  var %h = eggs. $+ #,%r $rand(1,20),%s $hget(%h,$nick) - 50
  if ($hget(%h)) {
    if (%s <= 0) msg # You only have $hget(%h,$nick) eggs and you need 50 to roll!
    else {
      if (%r isnum 1-3) var %p = 50
      elseif (%r isnum 4-6) var %p = -50
      elseif (%r isnum 7-10) var %p = $rand(1,250)
      elseif (%r isnum 11-13) var %p = $rand(1,500) - 250
      elseif (%r == 14) var %p = $rand(1,1000)
      elseif (%r isnum 15-17) var %p = $rand(1,1000) - 500
      else var %p = 0
      var %p = $iif(%p >= 0,+) $+ %p,%m Something something something you rolled <rand> and <gainedlost> <eggs>@Oh my Steve! You rolled <rand> and everything's fantastic! <eggs> eggs!@Once upon time $nick rolled <rand> and <gainedlost> <eggs> eggs. The end.@I guess you rolled <rand> and <gainedlost> <eggs> eggs. Congratulations!@<rand> roll means <eggs> eggs for you!
      hadd %h $nick $iif($calc(%s %p) >= 0,$v1,0)
      msg # $replacex($gettok(%m,$rand(1,$numtok(%m,64)),64),<rand>,%r,<gainedlost>,$iif(%p >= 0,gained,lost),<eggs>,%p) (You now have $hget(%h,$nick) eggs)
    }
  }
}

on *:start:unset %eggsonline.*

on *:text:!ticket:#: {
  var %h = eggs. $+ #,%p $hget(%h,$nick),%w @eggs. $+ #
  if ($hget(%h)) {
    if (!$window(%w)) .notice $nick Giveaway is not active currently, so you can't buy tickets.
    elseif (%p >= 50) {
      hadd %h $nick $calc(%p -50)
      aline %w $nick
      .notice $nick Ticket bought! You now have $iif($fline(%w,$nick,0) == 1,1 ticket,$bytes($v1,b) tickets) and $iif($hget(%h,$nick) == 1,1 egg.,$bytes($v1,b) eggs.)
    }
    else .notice $nick You need more eggs to buy a ticket! You currently have %p $iif(%p == 1,egg.,eggs.)
  }
}

on *:text:!eggs:#: {
  var %h = eggs. $+ #,%w @eggs. $+ #
  if ($hget(%h)) {
    if ($window(%w)) .notice $nick You currently have $iif($hget(%h,$nick) == 1,1 egg,$bytes($v1,b) eggs) and $fline(%w,$nick,0) tickets in the giveaway.
    else .notice $nick You currently have $iif($hget(%h,$nick) == 1,1 egg.,$bytes($v1,b) eggs.)
  }
}

menu channel {
  -
  Egg options
  .$iif(%eggsonline. [ $+ [ # ] ],Go offline,Go online):$iif(%eggsonline. [ $+ [ # ] ],unset,set) %eggsonline. [ $+ [ # ] ] 1
  .-
  .$iif($window(@eggs. $+ #),Conclude the giveaway): {
    var %w = @eggs. $+ #,%t $line(%w,0)
    if (%t > 0) msg # Giveaway is over: the winner is $line(%w,$rand(1,%t)) $+ !
    else msg # Giveaway is over: not enough participants.
    window -c %w
  }
  .$iif(!$window(@eggs. $+ #),Start a giveaway): {
    window -h @eggs. $+ #
    msg # A giveaway has started! You can buy tickets by typing !TICKET for 50 eggs each.
  }
  .-
  .Give everyone eggs: {
    var %h = eggs. $+ #
    if ($input(How many eggs would you give to the eggheads of # $+ ?,buqe,Eggs,50) > 0) noop $hfind(%h,*,0,w,hinc %h $1 $v1)
  }
  -
}

on *:join:#: {
  var %h = eggs. $+ #
  if ($nick == $me) {
    hfree -w %h
    hmake %h 100
    .timereggs. $+ # 1 600 addeggs #
  }
  elseif ($hget(%h)) && ($hget(%h,$nick) == $null) hadd %h $nick 100
}

on *:part:#:if ($nick == $me) saveeggs #

on *:kick:#:if ($knick == $me) saveeggs #

on *:disconnect: {
  var %x = 1
  while ($chan(%x)) { saveeggs $v1 | inc %x }
}

alias -l saveeggs {
  var %h = eggs. $+ $1
  if ($hget(%h)) {
    hsave -i %h Eggs.db $1
    hfree -w %h
    .timereggs. $+ # off
  }
}

alias -l addeggs {
  var %x = 1,%h eggs. $+ $1,%p $iif(%eggsonline. [ $+ [ $1 ] ],10,2)
  if ($hget(%h)) {
    while ($nick($1,%x)) { hinc %h $nick($1,%x) %p | inc %x }
    hsave -i %h Eggs.db $1
  }
}

raw 366:*:checkforneweggs $2

alias -l checkforneweggs {
  var %h = eggs. $+ $1,%x 1
  if ($hget(%h)) {
    while ($nick($1,%x)) { if ($hget(%h,$nick($1,%x)) == $null) hadd %h $nick($1,%x) 100 | inc %x }
    hsave -i %h Eggs.db $1
  }
}


Link Copied to Clipboard