Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2010-01-31 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
January 31, 2010, 10:22:46 AM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Races and Items added into Download section from our great Race Coders!
Such as... HOLLIDAY|NovaKiller|Stinkyfax|Frodo|TeacherCreature|Phat_Wizard
Google  
  Home   Forum   Help Search Login Register   *
Pages: [1]   Go Down
  Print  
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 Offline

United States 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

Yiyas
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 261


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« Reply #1 on: September 22, 2009, 06:02:47 AM »

You tried <cat_#>? aka <cat_1>
Logged

Cannon-Fodder
Level 2 Apprentice
**
Offline Offline

United States 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

Yiyas
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 261


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« 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 Offline

United States 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:

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

Yiyas
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 261


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« 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
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 261


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« 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 Tongue

Heres the replacement init, sorry for the delay:

Code
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 Offline

United States United States

Posts: 56


Skittles, rainbow, skittles, rainbow... @_@


« Reply #7 on: September 28, 2009, 07:17:50 AM »

I thankew AGAIN, Yiyas. Tongue

I'll test it out as soon as I figure out why my listen server crashes on startup. XD
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
January 30, 2010, 08:48:38 PM
wcs_alpha is used for effects to determine how visible/bright/see-through an effect is.
January 30, 2010, 05:44:23 PM
Has nothing to do with the speed. wcs_alpha is just a variable which can be used anywhere.
January 30, 2010, 05:40:44 PM
oh and thank you ^.^
January 30, 2010, 05:40:32 PM
ohh... but it shouldnt be with the settings of speed right?
January 30, 2010, 12:19:50 AM
wcs_alpha actually doesn't affect the invis as far as I know, it's just a variable which goes by wcs_invis.
January 29, 2010, 11:20:18 PM
ha ha copy paste fail below >.>
January 29, 2010, 11:19:30 PM
# Jessory: ok i got the answer.. i figured it was about the transperacy and i was right. except i seen wcs_alpha in the settings with speed... so it confused me abit and made me wonder why alpha was with speed.. found out its just extra crap is all
Recent
[Today at 02:33:17 AM]

by amiq
[Today at 02:18:57 AM]

[Today at 01:05:12 AM]

by amiq
[January 30, 2010, 10:13:03 PM]

[January 30, 2010, 09:03:05 PM]

[January 30, 2010, 08:12:16 PM]

[January 30, 2010, 03:50:21 PM]

[January 30, 2010, 01:24:55 PM]

[January 30, 2010, 08:54:50 AM]

[January 30, 2010, 07:39:49 AM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.507 seconds with 25 queries.