This made my gCLI text to be left aligned instead of right

fianor

Member
KoL mafia v14.3 r8702
java 6 update 22 (build 1.6.0_22-b04)
Win XP v5.1 (Build 2600.xpsp_sp3_gdr.100427-1636: SP3)

I am attempting to write this script to farm my 10 daily ducks, puttying the rotund duck if I come across one (via ducks.ccs).


Code:
cli_execute("concert winklered");
if ((get_property( "demonSummoned" )) == false)
    cli_execute("summon preternatural greed");
if ((to_float(item_amount($item [4403]))) == 1)
    cli_execute("outfit meatfarming1");
    else cli_execute("outfit meatfarming2");
cli_execute("familiar hobo");
if((to_float(get_property( "spookyPuttyCopiesMade" ))) == 5) 
    {
        cli_execute("ccs polys stasis");
        print ("No more Putty", "green");
        adventure(10 , $location[McMillicancuddy's Farm]);
    }
else
    {
        cli_execute("ccs ducks");
        repeat { 
            adventure(10 , $location[McMillicancuddy's Farm]);
            } until (last_monster() == to_monster("Rotund Duck"));
        cli_execute("ccs polys stasis"); 
        adventure(10 , $location[McMillicancuddy's Farm]);
##        cli_execute("ccs ducks"); 
##        while ((to_float(get_property( "spookyPuttyCopiesMade" ))) < 5 || item_amount($item[Spooky Putty monster]) > 0) 
##            use(1, $item[Spooky Putty monster]);
        set_property( "DWSAdvToday", 5 );
    }
if (item_amount($item[Spooky Putty monster]) > 0) 
    {
    print ("You've got a putty duck to kill", "green");
    cli_execute("ccs ducks");
    }
##    DWS cli_execute("call castlefarm.ash");

The 3 commented out lines are the beginning of making mafia fight the puttied ducks for me. DWS is my initials and I use them to mark my variable and comments in code so I always know what I wrote and what I borrowed. I have 7 scripts being used for my daily farming right now. DWSAdvToday is a variable I use to know what I have and haven't already done that day. Mostly just to keep me from rerunning a script that worked already when a later script crashes out and I start over.

Yes I recognize the potential for an infinite loop, was hoping that the error of "Nothing more to do here today." would kick it out. Lazy scripting I know, just didn't want to spend the time to write a turn counter is all. On my first attempt to run the script I had

Code:
        repeat { 
            adventure(1 , $location[McMillicancuddy's Farm]);
            } until (last_monster() == to_monster("Rotund Duck"));

which is what I think it really should be. The script however returned

Code:
Visit to Island: McMillicancuddy's Farm in progress...

[96382] McMillicancuddy's Farm
Encounter: zombie duck
Strategy: H:\Mafia\ccs\ducks.ccs [default]
Round 0: fianor wins initiative!
Round 1: fianor executes a macro!
Round 1: fianor uses the seal tooth!
Round 2: Boxcar Cheater climbs up and sits on your shoulder, and hands you some Meat. Huh, where did he find that?
You gain 68 Meat.
You lose 3 hit points
Round 2: fianor attacks!
Round 3: Boxcar Cheater eats a clove of garlic (wait, what's garlic?) and breathes a toxic cloud into its face for 68 damage.
After Battle: Boxcar Cheater sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 986 Meat
After Battle: Boxcar Cheater holds out the plastic pumpkin bucket, hoping for extra goodies.
You gain 8 Beefiness
You gain 27 Mysteriousness
You gain 10 Smarm

Conditions not satisfied after 1 adventure.

and stopped running. Which it should have been in the repeat loop and run until it found a rotund duck, or *I assumed* until it crashed out with "Nothing more to do here today." on the 11th attempt as usual.

So I changed the 1 to a 10 without really thinking clearly and ran it, resulting in the script first backing up 64 lines in the gCLI and reformatting them to left aligned and red text on all text that was black, leaving other colors of text their proper color. Then running 9 more adventures in the farm returning proper text in the new alignment. On request 10 it returned the new format but otherwise proper "nothing more..." and then went into the expected infinite loop of request 1 of 10 "Nothing more ..." with new formatting 13 iterations before I hit ESC. Oddly on iteration 7 the text color went back to the proper colors, but the alignment has stayed right instead of left.

Then I posted this. I have no idea what could have possibly changed the text color or alignment, but in case for some really odd reason you also wrote this same really bad script and were about to run it, don't.
 
Last edited:

Theraze

Active member
As a test, try pushing Left-Ctrl and Left-Shift together. In some cases, the left shift/ctrl combination makes the cursor/text go to the left side, and the right shift/ctrl combination makes it go to the right side.

Besides that? I'd start with a conditions clear to make sure you don't have a condition running and screwing things up, since that's what it said the problem was...
 

Winterbay

Active member
Also, getting the text back to the correct side can probably be done by doing a "cls" in the gCLI. That should clear out any oddities in the display.
 

fianor

Member
No combination of shift and ctrl keys did anything noticable whatsoever. I did have a goal set of +1 agua de vida, left over from bounty hunting with my sandworm. However, the script called for running adventures at the farm, 1 at a time until I'd fought a rotund duck while I had my hobo monkey out. This left open the possibility of an infinite loop of adv's once I've gotten to adv #10. Since it crashed out unexpectedly after 1 adv, then I changed it so that it should have had an infinite loop of adventures 10 at a time, which is when mafia decided to just say bad things about my mother.

CLS did clear everything out and caused further text to be correctly formatted.

I still have no clue what caused it to go wonky to begin with.
 
Last edited:

slyz

Developer
I think this happens for example when an HTLM tag is opened but the closing tag isn't there. While the lonely tag is still displayed, any text after it will be weird, but once it disappears from the buffer, all comes back to normal.

I don't know what caused the problem in your case (maybe a plastic pumpkin bucket message?), but once it is scrolled off the display, all comes back to normal.
 

Winterbay

Active member
I know that trying to equip an outfit of which you can't use all parts have given me that problem before, especially while running Alhifar's slime tube script.
 
Top