Help me with "scriplets"?

hippymon

Member
I use scripts from: http://kolmafia.us/index.php/topic,870.msg4512.html#msg4512 and in the "stash.txt" I would like to put the item in the mall instead of the clan stash, anyone know how to change this?

and

In the Breakfast script, I would like a add a scriptlet to acquire and use X can of hairspray, X=number of adventures divided by 3 (3 adv. of butt-rock hair are given per hairspray. Anyone know how to make this scriptlet?
 
Code:
int Get_Hairspray = myadventures()/3
cli_execute("buy Get_Hairspray Hairspray");

And I am too lazy to check out the other script to see how it looks, in order to tell you how to change it. But good luck!
 

dangerpin

Member
Well if it were ash it would use put_shop so since the txt file is using
Code:
stash put * stuffed spooky mushroom
for the put_stash
command I assume it would be
Code:
shop put * stuffed spooky mushroom

However, I am in hardcore and can't really test either the workings of the original script or this change.

Good luck.
 
[quote author=GhettoTrucker link=topic=969.msg4812#msg4812 date=1181616959]
Code:
int Get_Hairspray = myadventures()/3
cli_execute("buy Get_Hairspray Hairspray");

And I am too lazy to check out the other script to see how it looks, in order to tell you how to change it. But good luck!
[/quote]

Uh do you mean
Code:
int Get_Hairspray = my_adventures() / 3;
cli_execute("buy " + Get_Hairspray + " Hairspray");
?

Also because 10 divided by three equals 3.3333 if you have 10 adventures it will buy 3 leaving off 1 adventure. Instead:
Code:
int Get_Hairspray = my_adventures() / 3 + 1;

Finally:

Code:
Mallsell * stuffed spooky mushroom, * hairspray, * disco ball


Sorry that when I was asked over messenger I couldn't give a straight answer, my son and his grandma were fighting and dragging me into it again. It's impossible to think when they do that.
 

macman104

Member
For the hairspray, if you have 11 adventures though, you'll end up two adventures short, so...
Code:
int Get_Hairspray = my_adventures() / 3 + my_adventures() % 3;
No?
 

macman104

Member
[quote author=GhettoTrucker link=topic=969.msg4828#msg4828 date=1181687889]
What does the "Ceil()" function do?[/quote]Ceil(4.3) I believe return 5. So...if you have 8 adventures
Code:
int Get_Hairspray = ceil(my_adventures() /3);
print(Get_Hairspray);
would print 3, because ceil(8/3) = ceil(2.667) which is 3, so you'll always get the needed amount of hairspray that way. So any of the above 3 would work, we just all dealt with the remainder portion differently.
 

holatuwol

Developer
As macman104 summarized, "ceil" is basically an "always round up" function. If you want a more technical definition, check Wikipedia.

For people who pay attention during class, you should hear about it as early as first year algebra because it's a pretty fundamental function when you learn how to draw graphs (it's one of the three infamous 'step' functions, the other two being "floor" and "round").

For people who don't pay attention in class, it probably doesn't leave an impression on you until you take first year calculus and you talk about non-continuous functions. At that time, you discover it's one of the evil functions that strikes fear into your heart, and you learn to avoid it along with absolute value.
 
Oh ok. In all my algebra classes (so far 1,2, & 2c), we have only been taught the round() function on our calculators, because it is more complicated i guess, and they don't want us relying on our cals too much... Thanks for the clarification.
 
heh I was trying to use easy to read math for the newcomers...that and I never noticed the Ceil() function in kolmafia. There's several ways to go about it. No doubt about that.

Going back to Macman's comment:
[quote author=macman104 link=topic=969.msg4825#msg4825 date=1181666562]
For the hairspray, if you have 11 adventures though, you'll end up two adventures short, so...
Code:
int Get_Hairspray = my_adventures() / 3 + my_adventures() % 3;
No?
[/quote]

Actually "int Get_Hairspray = my_adventures() / 3 + 1;"
says take the number of adventures I have and divide by 3 so for 11 adventures you would get 3 (decimal/remainder ignored). Then add 1 and of course that's 4. 4 hairspray times 3 adv per is 12 adventures of the effect which means 1 to carry over till tomorrow.

since we are still on the topic, we don't need excess adventures of Butt-Rock Hair.

Code:
int Get_Hairspray = ceil( ( my_adventures() - have_effect( $effect[Butt-Rock Hair] ) )/3 );
 
Top