any script experts see any errors in this auction script?

Discussion in 'Scripts' started by privatestock, Jan 26, 2010.

  1. #1
    Purchased an auction software program off eBay... I'm a noob at script but I've been learning slowly with trial and error for the last few days and have the program almost where I need it. The only issue I believe is somewhere in this code for the auto or "proxy" bidding... if you set an auction with a reserve, and the bidding gets up to-and above the reserve amount, the 'reserve not met' text won't go away. The proxy bidding ends up not working properly until the bid amount reaches the reserve... example: bidding starts at $100, reserve is $400 and you decide to bid a MAX of $250; this program would bid the auction to $250 instead of proxying from $100. But if you bid $450, it would bid the auction to $400 and proxy from there.

    Any of you script experts see any errors in this code?

    #################### BEGIN OF AUTOBIDDER #######################
    ## The Bidder And The Autobidder:
    my $mybidder = sub {
    print NEW "\n$form{'ALIAS'}\[\]$form{'EMAIL'}\[\]$_[0]\[\]$_[1]\[\]$form{'ADDRESS1'}\[\]$form{'ADDRESS2'}\[\]$form{'ADDRESS3'}\[\]$form{'OQTY'}\[\]$form{'SOLDQTY'}"};

    my $autobidder = sub { my (@this) = &read_bid($bids[$#bids]); ($this[2], $this[3]) = ($_[0], $_[1]); print NEW "\n", join("[]", @this)};

    ## Now The Bids:
    if ($form{USEMAXBID} ne '' || !exists $form{USEMAXBID}){
    $form{MAXBID} = &parsebid($form{BID});
    $form{BID} = &parsebid($bid);
    $form{BID} = &parsebid($bid + $inc) if ($#bids);
    }

    my $proxy = ($time =~ /\d*\#(\d*\.?\d*)/ ? parsebid($1*1) : 0);
    my $message;
    #####################################################
    ## BID WAS IMMEDIATELY BEATEN SO RETURN WITHOUT EMAIL
    if($proxy >= $form{MAXBID} && $#bids >= 0){
    $form{BID} = &parsebid($form{MAXBID});
    &$mybidder($form{MAXBID}, "$^T#$form{MAXBID}#beaten");
    &$autobidder($form{MAXBID}, "$^T#$proxy#");
    #&$autobidder($form{MAXBID} + $inc, "$^T#$proxy#");
    $message = "Your bid was beaten by a proxy bid.<br><big><b>You are not the high bidder!</b></big>";
    }
    ## BID WAS IMMEDIATELY BEATEN BUT SUCCESSFULLY REBID
    elsif($proxy >= $form{BID} && $#bids >= 0) {
    &$mybidder($form{BID}, "$^T#$form{MAXBID}#beaten");
    &$autobidder($proxy, "$^T#$proxy#beaten");
    $form{BID} = &parsebid((($proxy + $inc) > $form{MAXBID}) ? ($form{MAXBID}) : ($proxy + $inc));
    &$mybidder($form{BID}, "$^T#$form{MAXBID}#");
    $message = "Your bid has been raised to $form{BID} in order to outbid an old proxy bid";
    }
    ###################################################
    ## RAISED TO RESERVE PRICE BUT RESERVE WAS TOO HIGH
    else {
    if($reserve > $form{MAXBID} && $form{MAXBID} > $form{BID}){
    $form{BID} = &parsebid($form{MAXBID});
    &$mybidder($form{BID}, "$^T#$form{MAXBID}#");
    $message = "Your bid has been raised to $config{'currencytype'}$form{BID} in order to meet the reserve price.<br>The reserve price is not yet met.";
    }
    ## SUCCESSFULLY RAISED TO RESERVE PRICE
    elsif($reserve > $form{BID} && $form{MAXBID} > $form{BID}) {
    $form{BID} = $reserve;
    &$mybidder($form{BID}, "$^T#$form{MAXBID}#");
    $message = "Your bid has been raised in order to meet the reserve price.<br>The reserve price was $config{'currencytype'}$reserve.";
    }
    #####################
    ## BID JUST REGULARLY
    else {
    if ($form{'bidtype'} eq 'std'){
    $form{BID} = $form{MAXBID};
    &$mybidder($form{BID}, "$^T#$form{MAXBID}#")
    }
    if ($form{'bidtype'} eq 'proxy'){
    &$mybidder($form{BID}, "$^T#$form{MAXBID}#")

    }
    }
    }
    unless ($form{'bidtype'} eq 'std'){
    $message .= "<br>The proxy will automatically bid for you until $config{'currencytype'}@{[parsebid($form{MAXBID})]}"
    if ($form{BID} < $form{MAXBID});
    }
    $message = "<p><b>Note:</b><br>$message</p>" if $message;
    print "<br>$form{'ALIAS'}, your bid has been placed on item number $form{'ITEM'} for $config{'currencytype'}$form{'BID'} on $nowtime $message<p>You may want to print this notice as confirmation of your bid.<P>Go <A HREF=\"$config{'returnurl'}?category=$form{'CATEGORY'}\&item=$form{'ITEM'}\">back to the item</A></p>";
    close NEW;
    return if($proxy >= $form{MAXBID});
    ###################### END OF AUTOBIDDER #########################
     
    privatestock, Jan 26, 2010 IP