| This topic has not yet been rated!
|
You have not rated this topic. Select a rating:
|
|
Author |
Topic: Restrict category not working as expected... (Read 125 times)
|
Cannon-Fodder
Level 2 Apprentice

Offline
 United States
Posts: 56
Skittles, rainbow, skittles, rainbow... @_@
|
 |
« on: September 22, 2009, 05:38:41 AM » |
|
I understand the pretext of restricting entire groups, and in theory understand how to do so... But for some reason, when it comes down to it, I failhard. :\
I've tried sticking <cat1> <category1> and <Spawn Items> in the item restriction init. but for some reason, it just doesn't block the category that I want it to. :\ I am using .77, and have customized my menus to suit my desire for restrictions, particularly, but when it gets down to it, I can only figure out how to restrict singular items...
Edit: Also tried <cat_1> and <cat 1>...
|
|
|
|
« Last Edit: September 22, 2009, 07:51:34 AM by Cannon-Fodder »
|
Logged
|
<3 Remember kids, never drink and code.
|
|
|
|
Yiyas
|
 |
« Reply #1 on: September 22, 2009, 06:02:47 AM » |
|
You tried <cat_#>? aka <cat_1>
|
|
|
|
|
Logged
|
|
|
|
Cannon-Fodder
Level 2 Apprentice

Offline
 United States
Posts: 56
Skittles, rainbow, skittles, rainbow... @_@
|
 |
« Reply #2 on: September 22, 2009, 07:26:17 AM » |
|
NO, I didn't! Thanks again, Yiyas! :p
Edit: Didn't work. xD
|
|
|
|
« Last Edit: September 22, 2009, 07:31:49 AM by Cannon-Fodder »
|
Logged
|
<3 Remember kids, never drink and code.
|
|
|
|
Yiyas
|
 |
« Reply #3 on: September 22, 2009, 07:52:25 AM » |
|
Baha, oh well. Thats what its supposed to be but maybe it isn't implemented yet. I'll try make something up for you after I done this changerace palava.
|
|
|
|
« Last Edit: September 22, 2009, 08:14:42 AM by Yiyas »
|
Logged
|
|
|
|
Cannon-Fodder
Level 2 Apprentice

Offline
 United States
Posts: 56
Skittles, rainbow, skittles, rainbow... @_@
|
 |
« Reply #4 on: September 24, 2009, 02:30:29 AM » |
|
I'm thinking that the reason that the Category restrict isn't working lays somewhere in this code: GeSHi (eventscripts): block wcs_shop_menu_init { // 10 (or 0) means back to the shopmenu if (server_var(wcs_counter) = 1) then popup submenu server_var(wcs_name) 10 shopmenu // check if user can buy item es_keygetvalue wcs_iname WCSshop server_var(wcs_key) name es_keygetvalue wcs_icost WCSshop server_var(wcs_key) cost es_keygetvalue wcs_ilevel WCSshop server_var(wcs_key) level es_keygetvalue wcs_idab WCSshop server_var(wcs_key) dab es_keygetvalue wcs_amount "WCSshop" server_var(wcs_key) maxamount es_xformatv wcs_tmp1 "item_%1" wcs_key es_keygetvalue wcs_tmp2 "WCSuserdata" server_var(_popup_userid) server_var(wcs_tmp1) if (server_var(wcs_tmp2) = "0") then es_xset wcs_tmp2 "0" if (server_var(wcs_amount) = "0") then es_xset wcs_tmp2 "-1" es_xset wcs_ok 0 es_xset wcs_allowed 1 ifx parse("(wcs_icost <= wcs_money) and (wcs_ilevel <= wcs_level) and (wcs_amount > wcs_tmp2) and ((wcs_idab == wcs_deadoralive) or (wcs_idab == 2))") do { es_xset wcs_ok 1 es_keygetvalue wcs_race WCSuserdata server_var(_popup_userid) race es_keygetvalue wcs_allowed WCSraces server_var(wcs_race) restrict_shop es_xformatv wcs_tmp1 "<%1>" wcs_key if (server_var(wcs_tmp1) in server_var(wcs_allowed)) do { es_xset wcs_ok 0 if ("<cat_" notin server_var(wcs_allowed)) then es_xset wcs_allowed 0 } // lock whole category if ("<cat_" in server_var(wcs_allowed)) do { es_token wcs_tmp1 server_var(wcs_allowed) 2 _ es_xstring wcs_tmp1 replace ">" "" if (server_var(wcs_tmp1) = server_var(wcs_category)) do { es_xset wcs_ok 0 es_xset wcs_allowed 0 } } }
For some reason, the wcs_allowed and wcs_ok don't get set to 0, and the items ends up purchase-able.. Any advice, or code that I could stick in the es_WCSshop.txt file to get the category restrict to work?
|
|
|
|
|
Logged
|
<3 Remember kids, never drink and code.
|
|
|
|
Yiyas
|
 |
« Reply #5 on: September 24, 2009, 05:58:38 AM » |
|
Look at the bit where it chooses what category you do instead, it appears that applies only on purchasing an item.
|
|
|
|
|
Logged
|
|
|
|
|
Yiyas
|
 |
« Reply #6 on: September 25, 2009, 08:30:51 PM » |
|
Nevermind, it appears the initial shopmenu is created on server start, which is good for saving some lag but not good for restricting it from the menu itself. I cannot be bothered reworking it cause atm I'm angry enough at menus  Heres the replacement init, sorry for the delay: GeSHi (eventscripts): block wcs_shop_menu_init { if (server_var(wcs_counter) = 1) then popup submenu server_var(wcs_name) 10 shopmenu es_keygetvalue wcs_iname WCSshop server_var(wcs_key) name es_keygetvalue wcs_icost WCSshop server_var(wcs_key) cost es_keygetvalue wcs_ilevel WCSshop server_var(wcs_key) level es_keygetvalue wcs_idab WCSshop server_var(wcs_key) dab es_keygetvalue wcs_amount "WCSshop" server_var(wcs_key) maxamount es_xformatv wcs_tmp1 "item_%1" wcs_key es_keygetvalue wcs_tmp2 "WCSuserdata" server_var(_popup_userid) server_var(wcs_tmp1) ifx false(wcs_tmp2) do { es_xset wcs_tmp2 "0" } ifx false(wcs_amount) do { es_xset wcs_tmp2 "-1" } es_xset wcs_ok 0 es_xset wcs_allowed 1 // can user pass all the requirements for item ifx parse("(wcs_icost <= wcs_money) and (wcs_ilevel <= wcs_level) and (wcs_amount > wcs_tmp2) and ((wcs_idab == wcs_deadoralive) or (wcs_idab == 2))") do { es_xset wcs_ok 1 es_keygetvalue wcs_race WCSuserdata server_var(_popup_userid) race es_keygetvalue wcs_allowed WCSraces server_var(wcs_race) restrict_shop ifx true(wcs_allowed) do { // is item itself restricted es_xformatv wcs_tmp1 "<%1>" wcs_key if (server_var(wcs_tmp1) in server_var(wcs_allowed)) do { es_xset wcs_ok 0 es_xset wcs_allowed 0 } // ok so item isnt restricted ifx true(wcs_ok) do { // is the category es_xformatv wcs_tmp1 "<cat_%1>" wcs_category if (server_var(wcs_tmp1) in server_var(wcs_allowed)) do { es_xset wcs_ok 0 es_xset wcs_allowed 0 } } } } ifx true(wcs_ok) do { es_xformatv wcs_text "%1 \n->%2. %3 ($%4)" wcs_text wcs_counter wcs_iname wcs_icost es popup menuvalue server_var(wcs_name) wcs_itemid server_var(wcs_counter) server_var(wcs_key) } es_xelse do { // not selectable item ifx parse("wcs_ilevel > 0") do { es_xformatv wcs_text "%1 \n%2. %3 ($%4) (lvl %5)" wcs_text wcs_counter wcs_iname wcs_icost wcs_ilevel } ifx false(wcs_ilevel) do { es_xformatv wcs_text "%1 \n%2. %3 ($%4)" wcs_text wcs_counter wcs_iname wcs_icost } wcs_getlanguage wcs_lng wcs_lng_shopoutofstock ifx true(wcs_amount) do { ifx parse("wcs_amount <= wcs_tmp2") do { es_xformatv wcs_text "%1 (%2)" wcs_text wcs_lng } } ifx false(wcs_allowed) do { es_xformatv wcs_text "%1 (R)" wcs_text } es popup menuvalue server_var(wcs_name) wcs_itemid server_var(wcs_counter) "-" } // IMPORTANT !! es_xmath wcs_counter + 1 }
|
|
|
|
|
Logged
|
|
|
|
Cannon-Fodder
Level 2 Apprentice

Offline
 United States
Posts: 56
Skittles, rainbow, skittles, rainbow... @_@
|
 |
« Reply #7 on: September 28, 2009, 07:17:50 AM » |
|
I thankew AGAIN, Yiyas.  I'll test it out as soon as I figure out why my listen server crashes on startup. XD
|
|
|
|
|
Logged
|
<3 Remember kids, never drink and code.
|
|
|
|
|
|