mIRC Home    About    Download    Register    News    Help

Print Thread
#168570 10/01/07 05:19 PM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
I want to be able to log a channel that has reports info from a game. I would like to be able to log only the last price change for different items, then have a trigger to recall the info for each item.

Like: xyz went UP to 5199 from 4600 and 1,871 are left at the new price.

Then have a trigger like !xyz and it would report the last change.


Thank you for any help.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
What is the format of the price change lines. We'd need to know what the exact format is for all changes to do this. Are they all exactly like the one you showed?

item(one_word) went UP/DOWN to #### from #### and #### are left at the new price.

Is that always the format? Or can the item have multiple words? Or can it have different formats?

Also, is this always from a bot (specific nick) rather than from all users?


Invision Support
#Invision on irc.irchighway.net
Riamus2 #168575 10/01/07 06:00 PM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
They are all from the same bot, but sometimes it disconnects and may comeback as a different nick. Always the same hostmask though.

The only thing that changes is the xyz in the format. Of course the amounts would vary for each item tracked.

Thanks

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on *:start: {
  hmake Prices 100
  if ($isfile(Prices.hsh)) { hload Prices Prices.hsh }
}

on *:text:*are left at the new price.:#yourchannel: {
  if (!$hget(Prices)) { hmake Prices 100 }
  hadd Prices $1 $3 $5 $7 $9
  hsave Prices Prices.hsh
}

on *:text:!Price &:#yourchannel: {
  var %item = $2
  tokenize 32 $hget(Prices,%item)
  msg $chan %item went $1 to $2 from $3 and $4 are left at the new price.
}


That should work. To get the last change for an item, use !Prices item (Example: !Prices xyz).

Note that this is set up to work with one-word items. If there are multi-word items, let me know.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #168590 10/01/07 08:53 PM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
I appreciate your help, but does not seem to be working. I put:

on *:start: {
hmake Prices 100
if ($isfile(Prices.hsh)) { hload Prices Prices.hsh }
}

on *:TEXT:*are left at the new price.:#Markets: {
if (!$hget(Prices)) { hmake Prices 100 }
hadd Prices $1 $3 $5 $7 $9
hsave Prices Prices.hsh
}

on *:text:!Troops &:#Markets: {
var %item = $2
tokenize 32 $hget(Prices,%item)
msg $chan %item went $1 to $2 from $3 and $4 are left at the new price.
}


I assume for each item I would change the trigger? eg: troops, turrets, tanks, blah blah.

edit I even tried to put each item after the on :TEXT: * to each item

Edit 2: Oh I see, I need to !prices xyz, could it be made to just use each item name? like jets, turrets, food, yadda yadda?

Thanks again

Last edited by danzigrules; 10/01/07 09:51 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It can be made to not use !prices, but then you're checking every single ! and that is kind of a waste. But, if you want to have it do that, then here you go:

Code:
on *:start: {
  hmake Prices 100
  if ($isfile(Prices.hsh)) { hload Prices Prices.hsh }
}

on *:text:*are left at the new price.:#yourchannel: {
  if (!$hget(Prices)) { hmake Prices 100 }
  hadd Prices $1 $3 $5 $7 $9
  hsave Prices Prices.hsh
}

on *:text:!*:#yourchannel: {
  var %item = $right($1,-1)
  if (!$hget(Prices,%item)) { return }
  tokenize 32 $hget(Prices,%item)
  msg $chan %item went $1 to $2 from $3 and $4 are left at the new price.
}


Remember that if you add other scripts (like your !commands script), you'll need to put those into a NEW file and not into this file unless you're combining the on TEXT events because they will override each other as explained in the other post of yours.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169551 25/01/07 03:08 AM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
Man I have been busy.

First off I want to thank you for all your help again, but I am having a problem with the first one you did for me.

The output is not showing any numbers, just the text.

also, can it be made to do !agri = agricultural, !oil = oil_barrels, and the like?

if we have to do !prices agri that works to, but !agri would be ideal.

Thank you tons

danzigrules

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'm not sure about the numbers. The only reason they shouldn't show up is if you don't have data for them. If you want to troubleshoot it with me, join the channel in my signature and wait until I am around.

Try this for the shortened commands...

Code:
on *:start: {
  hmake Prices 100
  if ($isfile(Prices.hsh)) { hload Prices Prices.hsh }
}

on *:text:*are left at the new price.:#yourchannel: {
  if (!$hget(Prices)) { hmake Prices 100 }
  hadd Prices $1 $3 $5 $7 $9
  hsave Prices Prices.hsh
}

on *:text:!*:#yourchannel: {
  var %item = $right($1,-1)
  if ($hfind(Prices,%item $+ *,0,w) != 1) { .notice $nick No such item or multiple items have the same matching letters if you're using a shortened search. | return }
  tokenize 32 $hget(Prices,$hfind(Prices,%item $+ *,1,w))
  msg $chan $hfind(Prices,%item $+ *,1,w) went $1 to $2 from $3 and $4 are left at the new price.
}


That will let you do !agri or !oil or whatever. As long as there is only 1 match, it will give you an output. If you had oil and oranges, you couldn't do !o to get the results. But !or or !oi would work assuming there aren't any other items with those beginning letters.

As a word of warning, if you had oil and oil_barrels, you couldn't get data for oil because of this. If you think that's a problem, let me know and I can make it a bit more complex to handle that.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169599 25/01/07 11:17 PM
Joined: Dec 2006
Posts: 46
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
I just noticed that there is one item that wouldn't work, there is a military and a military_strategy, item.

It is still not showing the numbers, and I am on the server and chan in your sig.

I have to leave the house in about 45 minutes, but should be back about 15 minutes later.

Thanks again for your help

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, this will work for your military one.

Code:
on *:start: {
  hmake Prices 100
  if ($isfile(Prices.hsh)) { hload Prices Prices.hsh }
}

on *:text:*are left at the new price.:#yourchannel: {
  if (!$hget(Prices)) { hmake Prices 100 }
  hadd Prices $strip($1 $3 $5 $7 $9)
  hsave Prices Prices.hsh
}

on *:text:!*:#yourchannel: {
  var %item = $right($1,-1)
  if ($hfind(Prices,%item $+ *,0,w) != 1 && !$hget(Prices,%item)) { .notice $nick No such item or multiple items have the same matching letters if you're using a shortened search. | return }
  if ($hget(Prices,%item)) { var %itemname = %item }
  else var %itemname = $hfind(Prices,%item $+ *,1,w)
  tokenize 32 $hget(Prices,%itemname)
  msg $chan %itemname went $1 to $2 from $3 and $4 are left at the new price.
}

Last edited by Riamus2; 26/01/07 04:10 AM.

Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard