Legal script?

DeletedUser

It has never had multiple sale items feature as far as I know. In beta they had it once but they disabled it there too! Uhh. It sure is a pain to sell multiple stacked items one-by-one all the time. :/ It´s so time consuming.

And actually, from the Beta forums topic, darkguardian666 made it sound like selling for below the minimum wasn't the only issue with it, but it also wasn't intended for selling in lots, just creating multiple postings at once, so it wouldn't even be any more convenient for buyers. I might be wrong though, it's been a while since I've read it.
 

DeletedUser

I hope in future update we will get this, but has to be programmed right. I guess it´s hard to implement this as it´s taking so long. lol.
 

DeletedUser

oh really? i did think i was ok to use it as long as you follow the rules? It is a shame, i can't understand why we have to sell items one at the time...
 

DeletedUser

I don't think there's anyone who thinks posting multiple items would be a bad thing. ;)
 

DeletedUser16928

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

I made another script with a similar purpose, which shouldn't give you any more opportunity to break pushing rules and therefore should be allowed to use.

More specifically, it works on a completely different basis - instead of allowing you to sell multiple items in one market auction, it just automatically repeats the auction for as many times as you need. So just enter a number in the old, familiar field and the script will quietly send the server request the required number of times. Now you don't have to fill out the same info any more ;).
Just remember - the price you are typing is the price for one piece of the stack you are selling, not for the whole amount!

I strongly recommend not to use the script until the Game Support members confirm it's allowed in your local game version.

Step 1: Copy and paste whole code below to your URL bar in The West game
Code:
javascript:
/* made by Petee (TW-DB.info), all rights except redistribution reserved */
var TC = Market.prototype.prepareTraderControl.toString(); var R = 0;
TC = TC.replace(/n *> *1 *&& *false *\? *['"]<tr><td>['"] *\+ *['"][^"]+:['"] *\+/, function(str){R++; return "n>1?'<tr><td>'+'Repeat this sale (*):'+";});
TC = TC.replace(/id=['"]market_n['"] *value=[(?:\\")'"]{2} *\+ *n *\+ *[(?:\\")'"]{2}/, function(str){R++; return str.replace(/\+ *n *\+/,"+1+");});
TC = TC.replace(/"<\/table><br \/><\/div>"/, function(str){R++; return '"</table>"+(n>1?"* - <font size=1>This setting will instruct the game to repeat this same auction the specified number of times.</font>":"")+"<br /></div>"';});
TC = TC.replace(/Ajax.remoteCall\(['"]building_market['"], *['"]putup['"], *{town_id: *that.townId, *item_id: *item.get_id\(\), *auctionprice: *min_bid, *maxprice: *max_price, *itemcount: *nsell/,
function(str){R++; return "for(var i=0;i<nsell-1;i++) Ajax.remoteCall('building_market','putup',{town_id:that.townId,item_id:item.get_id(),auctionprice:min_bid,maxprice:max_price,itemcount:1,sellrights:(charHasTown?rights:2),auctionlength:days,description:$('auction_description').value},function(){;});"
+"Ajax.remoteCall('building_market','putup',{town_id:that.townId,item_id:item.get_id(),auctionprice:min_bid,maxprice:max_price,itemcount:1";}); /* the 1 to the left completely disables the original purpose of the Amount field */
Market.prototype.prepareTraderControl = eval("("+TC+")");
alert('Market patch by Petee '+(R==3?"applied successfully!":"was not applied :(. Try it again after refreshing window (isn't the script already applied?). If it just won't work, please contact Petee on the .net forums.")+' \n\nThanks to Lekensteyn for the inspiration from his original script. Please, support me by visiting http://tw-db.info/ !');
if(R!=3)window.location.reload(); void(0);
Step 2: Run it. An alert box should inform you about the result.
Step 3: On market, try to sell an item (of course, you need to have more than one piece)
Step 4: If you refresh the window, apply the script again. Or rather use the automatic UserScript.

Should be working on Firefox, Chrome and Opera, other browsers not checked. I'm also planning to include it in my UserScript. (done)

More info for admins:
[SPOIL]
Code:
javascript:
/* made by Petee (TW-DB.info), all rights except redistribution reserved */
 -> in other words, guys, [B]please[/B] don't modify the thing without my permission
var TC = Market.prototype.prepareTraderControl.toString();
 -> get the original code
var R = 0;
 -> a variable to check how many changes were done
TC = TC.replace(/n *> *1 *&& *false *\? *['"]<tr><td>['"] *\+ *['"][^"]+:['"] *\+/, function(str){R++; return "n>1?'<tr><td>'+'Repeat this sale (*):'+";});
 -> bypass the thing devs used to disable the feature, as in the old script; change field description
TC = TC.replace(/id=['"]market_n['"] *value=[(?:\\")'"]{2} *\+ *n *\+ *[(?:\\")'"]{2}/, function(str){R++; return str.replace(/\+ *n *\+/,"+1+");});
 -> set the default number of repeats to 1
TC = TC.replace(/"<\/table><br \/><\/div>"/, function(str){R++; return '"</table>"+(n>1?"* - <font size=1>This setting will instruct the game to repeat this same auction the specified number of times.</font>":"")+"<br /></div>"';});
 -> add some simple help text
TC = TC.replace(/Ajax.remoteCall\(['"]building_market['"], *['"]putup['"], *{town_id: *that.townId, *item_id: *item.get_id\(\), *auctionprice: *min_bid, *maxprice: *max_price, *itemcount: *nsell/,
function(str){R++; return "for(var i=0;i<nsell-1;i++) Ajax.remoteCall('building_market','putup',{town_id:that.townId,item_id:item.get_id(),auctionprice:min_bid,maxprice:max_price,itemcount:1,sellrights:(charHasTown?rights:2),auctionlength:days,description:$('auction_description').value},function(){;});"
+"Ajax.remoteCall('building_market','putup',{town_id:that.townId,item_id:item.get_id(),auctionprice:min_bid,maxprice:max_price,itemcount:1";}); /* the 1 to the left completely disables the original purpose of the Amount field */
 -> this is the part which actually tells the server to put the item on the market
 -> itemcount:1 means that the Amount variable will not be used, so it will not enable players to sell multiple items at once
 -> there is also a loop which runs the request n-1 times; the n-th time, it will also handle the server response (display the message, alter the local inventory, etc.)
Market.prototype.prepareTraderControl = eval("("+TC+")");
 -> apply the changes
alert('Market patch by Petee '+(R==4?"applied successfully!":"was not applied :(. Try it again after refreshing window (isn't the script already applied?). If it just won't work, please contact Petee on the .net forums.")+' \n\nThanks to Lekensteyn for the inspiration from his original script. Please, support me by visiting http://tw-db.info/ !');
if(R!=4)window.location.reload();
 -> this piece of code is a safetyguard; if the 1st replace succeeded and the 4th one failed, players could make use of the disabled feature; in that case, reload the page and discard any changes
void(0);
[/SPOIL]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
Last edited by a moderator:

DeletedUser

awesome! Could this be modified for buyers too? I mean, sellers will be selling a group of items for the same price so couldn't a script be made for the buyers to buy that group of items?
 

DeletedUser

i dont know if this script is legal or not but it didnt work when i tryed it :huh:
 

DeletedUser16928

What browser are you using? Exact version would be helpful. Also, what world did you try it on?
 

DeletedUser

nice one Petee....yeah it would be great if you could collect them in one hit on the other side...but its a step forward in the right direction....wanna see more..........:D
 

DeletedUser16928

Google chrome, i tryed it on world 12
I tried to apply the script on EN12 using Chrome and apparently, there were no problems at all... However, I better won't try to use it until it's allowed here... But I discovered and fixed an regex error which made the script dysfunctional on language versions using non-ASCII characters in the word Amount.
nice one Petee....yeah it would be great if you could collect them in one hit on the other side...but its a step forward in the right direction....wanna see more..........:D
Sadly, the script was not allowed on beta, the only world I play on, which would make the development and debugging process a lot harder. But yes, it definitely is possible. Let's just wait if it gets approved here...
 

DeletedUser

Thanks Peete,

This is greatly appreciated. A version for buyers would be great also! :D
 

DeletedUser16928

Thanks :)... I'll start working on the buyer's part right now... ;)
 

DeletedUser

YES.....excellent......a well needed script, nice one Petee and to lekensteyn for the idea.....
 

DeletedUser16928

A complete market solution is now finished! :)
Market offers/records in the Offers, Sales offers and the Bids for purchase tabs are now grouped together, if they are similar. And they can be also treated like a group, that means you can buy or fetch the whole group at once! It can be said, that the script now almost completely imitates the behavior of the long-expected multisale feature. The only thing it doesn't interfere with is the Market delivery premium, to keep your nuggets safe. However, you can still use it as before.

Because the new addition to the script is quite huge (around 5.5K characters), I will only release it in the UserScript. Check it out here: http://userscripts.org/scripts/show/96584 or here: http://forum.the-west.net/showthread.php?p=590513#post590513
 
Last edited by a moderator:

DeletedUser

you're amazing, petee! written in just a day.....major kudos to you. :D
 
Top