Me and my questions strike back!

itamaram

Member
I am planning a super-secret bot for my birthday at the moment and I was wondering about several commands and whether or not they are available in .ASH scripting.

First, is there a way to refresh your page every set amount of time so that you won't get logged out due to inactivity?

Second, can a script interact with the chat?

Also, when going to a mode similar to a buffbot (as in waiting to get messages containing a set amount of meat) can your respond be a counter message or a gift sending rather than a buff casting?

I know that the Otori bot have the once-a-day function. can Ash scripting provide a similar function?

And lastly (for now anyway) is there any possibility of randomness or arrays in ASH scripts?

Thanks, and be ready for my birthday! (20th of May thanks for asking)
 
First: Kind of. You could do a loop of something like:
Code:
wait( 900);
cli_execute( "refresh effect");

This would hit the servers every 15 minutes or so to check what your current effects are.

Second: No. Not in any way.

Also: Not that I am aware of.
Sub-Also: It is possible to program in a "once a day" limit.... It wouldn't be easy, and I am sure it isn't what you are asking for...

Lastly: Only in whatever method you come up with to make it yourself.
 

Tirian

Member
I know that the Otori bot have the once-a-day function. can Ash scripting provide a similar function?

You can hack it as long as you don't need too many of them. Write a breakfast script that buys one Kentucky-style derby. When you want to do whatever function you only want to do once a day, make sure that you have a derby before running it, and then sell the derby right afterwards. You can do this for as many NPC-sold items you don't actually use in the game and don't mind auto-selling for a loss.
 

Nightmist

Member
[quote author=Tirian link=topic=140.msg671#msg671 date=1146764263]
*Ingame Counter Idea*
[/quote]
You could just use a Closet <-> Inventory movement of items. (But the same limitation applies, one item per "once a day")
 
I'll touch on 2 questions:
Randomness:
write a batch file to generate a simple standard script which will create a number of meat paste, and set it into a loop of re-writing the script using a random number.
using the file_exists command in the batch file, and the "mirror filename" followed by just "mirror" in your script to create the file would be the trigger. delete the file in the batch file. Using the call command in your script, it would call the script which would create the meat paste, then a call to item_amount($item[meat Paste]) would give you the random number in kolmafia. Follow that with a call to autosell the meat paste. Uggh, batch files again!

Arrays:

To create an array of constants, you could use a set of functions something like this:

Presto Ragu's Restorer selector crunched down to fit in a smaller file.
Code:
item MPitem(int a)
  {
//Adjust the MP items as you see fit.  MPitem1 is the "worst" item, while MPitem9 is the "best"
  if(a == 1) return $item[soda water];
  if(a == 2) return $item[Knob Goblin seltzer];
  if(a == 3) return $item[Mountain Stream soda];
  if(a == 4) return $item[Dyspepsi-Cola];
  if(a == 5) return $item[green pixel potion];
  if(a == 6) return $item[tiny house];
  if(a == 7) return $item[Knob Goblin Superseltzer];
  if(a == 8) return $item[blue pixel potion];
  return $item[phonics down];
  }

item HPitem(int a)
  {
//Adjust the HP items as you see fit.  HPitem1 is the "worst" item, while HPitem9 is the "best"
  if(a == 1) return $item[Doc Galaktik's Pungent Unguent];
  if(a == 2) return $item[Doc Galaktik's Ailment Ointment];
  if(a == 3) return $item[Doc Galaktik's Restorative Balm];
  if(a == 4) return $item[Doc Galaktik's Homeopathic Elixir];
  if(a == 5) return $item[cast];
  if(a == 6) return $item[tiny house];
  if(a == 7) return $item[red pixel potion];
  if(a == 8) return $item[phonics down];
  return $item[scroll of drastic healing];
  }

item restorer_selecter( string restquant, string resttype)
  {
  item useitem;
  boolean usebest;
  boolean useHP;
  int count;
  count = 2;
  //start count at 2,  
  if(resttype == "hp" || resttype == "Hp" || resttype == "HP")
    {
    useitem = HPitem(count);
    while(count < 10)
      {
      if(item_amount(HPitem(count)) > 0)
        {
        if(restquant == "best" || restquant == "Best" || restquant == "BEST")
          {
          useitem = HPitem(count);
          }
          else
          {
          if( item_amount(HPitem(count)) > item_amount(useitem))
            {
            useitem = HPitem(count);
            }
          }
        }
      count = count + 1;
      }
    }		
    else
    {
    useitem = MPitem(1);
    while(count < 10)
      {
      if( item_amount(MPitem(count)) > 0)
        {
        if(restquant == "best" || restquant == "Best" || restquant == "BEST")
          {
          useitem = MPitem(count);
          }
          else
          {
          if( item_amount( MPitem(count)) > item_amount( useitem))
            {
            useitem = MPitem(count);
            }
          }
        }
      count = count + 1;
      }
  return useitem;
}

void main()
{
	cli_execute( "abort You are silly if you think this can run on its own.");
}

This method could be used with global variables also. That would allow changing the values in the array, but would be more complex to write.
 

itamaram

Member
Thank you all for your answers. But sadly efilnikufecin have forgot I have no programming knowledge whatsoever using batch files can you show me small example of what you meant about randomness? The array tip would be put into great use though...

Anyway, I thought I might as well reveal the reasons to all of my questions as someone might have a better idea to execute my idea.

So here it goes: On my birthday, I am planning on making my character a temporary birthday bot. Send me a trigger (eg 1 meat attached to a message), and you will get a choice of a random goody bag from me. Spread my happiness all around the globe!

my main concern is how to. And scamzors which will repeatedly send me messages and take all of my goody bags away.

Can anyone help me about that?

Thanks, Itamar
 

Nightmist

Member
What your attempting to do sounds like alot more then what a script is going to be able to handle since message checking in that manner is a very special buffbot thing and I dont think the ability was added to scripting.
 
[quote author=Nightmist link=topic=140.msg683#msg683 date=1146799234]
What your attempting to do sounds like alot more then what a script is going to be able to handle since message checking in that manner is a very special buffbot thing and I dont think the ability was added to scripting.
[/quote]
Agreed, Agreed, and most of all Agreed!
 

itamaram

Member
NO!!!!!!
Oh well, anti-raffles for everyone!

Also, I've just got 2 messages from Jick!! One of them said happy birthday and the other one saying he misread the date on the Kmail asking him to wish me happy birthday...
 

macman104

Member
[quote author=itamaram link=topic=140.msg705#msg705 date=1146880490]
Anyway, is there a condensed list of ASH commands regarding mall shop managment?[/quote]Well, considering there is only one ASH command for dealing with the mall, yes there is a condensed list ;D So, striaght from the ASH reference in the user manual:
Code:
boolean put_shop( int price, int limit, item )
Puts all of the given item into your mall store at the given price (or at your current offering price if zero and some are already present, or at 999,999,999 if the price is specified as zero and none are present) with the specified limit on purchases per person per day.
 

itamaram

Member
[quote author=macman104 link=topic=140.msg706#msg706 date=1146883582]
Well, considering there is only one ASH command for dealing with the mall, yes there is a condensed list ;D  So, striaght from the ASH reference in the user manual:
Code:
boolean put_shop( int price, int limit, item )
Puts all of the given item into your mall store at the given price (or at your current offering price if zero and some are already present, or at 999,999,999 if the price is specified as zero and none are present) with the specified limit on purchases per person per day.
[/quote]

Thanks for that. I am not really sure what was I expecting for except this one...
 
Top