Script Input

Kli1195

New member
I've never created a script, so I have no idea how to go about this, but I noticed that when you ran certain Crimbo 11 Tables scripts, they asked you how much you want to input in a pop-up window.
How would I write a script that says:
"Use black snowcone? Y/N"
And allows me to input a value into a box and enter it?
 

Grotfang

Developer
I've never created a script, so I have no idea how to go about this, but I noticed that when you ran certain Crimbo 11 Tables scripts, they asked you how much you want to input in a pop-up window.
How would I write a script that says:
"Use black snowcone? Y/N"
And allows me to input a value into a box and enter it?

To allow for user input as a script is initialised/started all you need to do is create your variables within void main(). So, what you are looking for is a boolean input (True/False) and the way to implement this would be:

Code:
void main( boolean use_black_snowcone )
{
    if( use_black_snowcone )
    {
        use( 1 , $item[black snowcone] );
    }
}

Note, the use() is for illustration only - it does not have to be there.

Integer input:

Code:
void main( int x )
{
    code
}

String input:

Code:
void main( string x )
{
    code
}

Location input:

Code:
void main( location x )
{
    code
}

Skill input:

Code:
void main( skill x )
{
    code
}

You get the point...

You can have more than one parameter inside void main() allowing for sequential inputs:

Code:
void main( boolean v , int w , string x , location y , skill z  )
{
    print( "Boolean: " + to_string( v ) );
    print( "Int: " + to_string( w ) );
    print( "String: " + x );
    print( "Location: " + to_string( y ) );
    print( "Skill: " + to_string( z ) );
}

The last one can be saved as an ASH script and run so you can see how the input appears to end users.
 
Last edited:

Kli1195

New member
Oh wow, thank you so much!

Also, a bit unrelated, but is it possible to code a script that keeps adventuring in an area until you get a certain noncombat?
Ex. I'm trying to get it so that it automatically uses an Agua de Vida, then keeps adventuring until it gets a blue milk club card, and gets the Dance Interpreter effect, and uses another agua de vida if the first one is smashed.
This is probably really complicated, so I don't know if it's possible.
 

heeheehee

Developer
Staff member
It's probably in your goals and/or Choice Advs settings (for choice advs, don't forget to look under items, not zone!). An easy way to go around doing this would be to set your choice adv settings as desired, then execute the following code (it requires Zarqon's zLib, but a lot of scripters use it nowadays -- you should, too!):

Code:
import <zlib.ash> // This goes at the top of your script.

obtain(1,"blue milk club card",$location[seaside megalopolis]);
adventure(1,$location[seaside megalopolis]);
 
Last edited:

Kli1195

New member
Oh yeah, I forgot about that...
Thanks a lot though, this helps loads!

I'm not entirely sure if it already exists, but I'm trying to create a script that buffs your +item to as high as possible for the purpose of hobopolis bosses.

Is there a way to get the Bureaucratized effect by specifically using the Tunnel Upwards skill 4/9 of the combats, and then get the Extra Sensory Perception buff immediate afterwards?
 

heeheehee

Developer
Staff member
Set your first CCS with "skill tunnel downwards" somewhere in there, then adventure 5 times, then switch to a CCS without it, then adventure 6 times. Code to be attached in a bit while I experiment some...

Edit: Add "consult mole.ash" to your CCS (see attachment), then add the following to your script:
Code:
buy(2,$item[llama lama gong]);
cli_execute("gong mole");
adventure(12,$location[Molehill]);
cli_execute("gong roach item");

That should do all that you asked for, unless I screwed up somewhere else.
 

Attachments

  • mole.ash
    233 bytes · Views: 33
Last edited:

zarqon

Well-known member
Code:
<import zlib.ash>

obtain(1,"blue milk club card",$location[seaside megalopolis]);
adventure(1,$location[seaside megalopolis]);

Unfortunately, this may actually not work if you don't get the item before your agua de vida expires, since mafia auto-stops when your agua de vida runs out. Perhaps I ought to add some kind of special handling to obtain() for agua de vida zones. Otherwise you have to use a while loop.

Another point: for boolean input, user_confirm(message) still exists. But if you use it, I guarantee people will complain about it.
 
Top