This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

AnyMAL — rapid development suite


Post New Thread Reply   
 
Thread Tools Display Modes
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-05-2011 , 10:29   Re: AnyMAL — rapid development suite
Reply With Quote #11

Quote:
Originally Posted by Shadows In Rain View Post
Rows may be duplicated for tables with and without primary key...
That's wrong. Primary key guarantees that there are no duplicate rows.
From http://en.wikipedia.org/wiki/Primary_key:
Quote:
In relational database design, a unique key can uniquely identify each row in a table, and is closely related to the Superkey concept. A unique key comprises a single column or a set of columns. No two distinct rows in a table can have the same value (or combination of values) in those columns if NULL values are not used.
__________________
Impossible is Nothing
Sylwester is offline
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-05-2011 , 11:42   Re: AnyMAL — rapid development suite
Reply With Quote #12

@Sylwester
Unique key != primary key. And anyway i see no reasons to use one of them. What problem, if two rows will be identical? What if client needs to write and read duplicated rows? Let it be a possibility, not bug. Easier to understand, easier to write, easier to debug. I must specify in documentation that such behavior is expected, and follow this rules in further releases.
Thanx, you open my eyes.)
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-05-2011 , 12:23   Re: AnyMAL — rapid development suite
Reply With Quote #13

AnyMAL Addons.

What is it?
By default, AnyMAL comes with some optional addons. Both relies on AnyMAL IDS Common to work.

1. Weapon speed.
This one adds some inventory weight realism. More items player carried — more slowed down. Armor also slows down.

2. Low health.
If player health drops below specified factor, speed gradually decreases and heartbeat becomes audible.

Related files
anymal_addon_*
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-06-2011 , 00:46   Re: AnyMAL — rapid development suite
Reply With Quote #14

AnyMAL MB.

What is it?
Menu Builder allows you to build menus without care about item indexes, formatting, page navigation, also allows to share menus, so other plugins can hold positions in your menu for their items.

How to obtain menu handle.
First, declare cell for MB's handle:
Code:
new MBH:mymenu_handle
And then register new handle during IPM-init:
Code:
mymenu_handle = anymal_mb_register(true)
How to build usual menu.
Notify AnyMAL MB that you want to show your menu:
Code:
anymal_mb_show(mymenu_handle, player)
Then watch for requestion forward, you must accept your menu and set some params during response:
Code:
public anymal_mb_requested(MBH:handle, player, page)
{
	if(handle != mymenu_handle)
		return
	
	anymal_mb_accept("My menu", "choose something please :)", 2, false)
}
If you accepted your menu (otherwise it will be not shown), next forward will be broadcasted, where you update your menu items or whole pages:
Code:
public anymal_mb_item_shown(MBH:handle, player, item, menuitem, page)
{
	if(handle != mymenu_handle)
		return

	if(menuitem == 1)
		anymal_mb_update_item("Give me candy")
	else
	if(menuitem == 2)
		anymal_mb_update_item("Explode me")
}
How to build injection-enabled menu.
If you plan to allow others to inject into your menu, you must at least give them your handle. For example, in mymod.inc:
Code:
// my menu offers you slots for your items
native MBH:mymod_mymenu()
And then in mymod.sma:
Code:
public MBH:_mymenu()
{
	return mymenu_handle
}
At this point, your menu becomes injectable, or "public" menu. Next steps are identical to usual menus, excepting 2 things:
1. do not hook anymal_mb_item_shown forward
2. call anymal_mb_injections to get number of items/pages, injected into your menu, and pass that value to anymal_mb_show:
Code:
anymal_mb_accept("My menu", "choose something please :)", anymal_mb_injections(mymenu_handle), false)
If you plan to place some your own items in your public menu, you need to inject them just like any 3rd-party plugin does it.

How to inject items in public menu.
First, you need to obtain and save menu handle:
Code:
othermenu_handle = othermod_menu()
Then get injection index(es):
Code:
option_1_injin = anymal_mb_inject(othermenu_handle)
option_2_injin = anymal_mb_inject(othermenu_handle)
option_3_injin = anymal_mb_inject(othermenu_handle)
Update them in corresponding forward:
Code:
public anymal_mb_item_shown(MBH:handle, player, item, menuitem, page)
{
	if(handle != mymenu_handle)
		return

	if(item == option_1_injin)
		anymal_mb_update_item("Skills")
	else
	if(item == option_2_injin)
		anymal_mb_update_item("Shop")
	else
	if(item == option_3_injin)
		anymal_mb_update_item("Help")
}
About navigation.
If you registered your menu handle with navigation, menu item #8 and #9 will be reserved for "Back" and "Next". Menu item #10 (assigned to zero button) always reserved for "Exit".

Related files.
anymal_mb*

Notes
  • Use IPM if you plan to use this API during initiallization time.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|

Last edited by Shadows In Rain; 03-06-2011 at 01:13.
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
katna
Senior Member
Join Date: May 2010
Old 03-06-2011 , 00:48   Re: AnyMAL — rapid development suite
Reply With Quote #15

You can set the row unique and use
Code:
INSERT INTO (`a`, `b`, `c`) VALUES ('1', '2', '3')
ON DUPLICATE KEY UPDATE c=3;
this code try to insert into mysql and check if the unique or primary key does't duplicate otherwise, update c to 3
katna is offline
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-06-2011 , 00:55   Re: AnyMAL — rapid development suite
Reply With Quote #16

@katna
Good practice when dealing with direct access to MySQL. But i must keep behavior identical for different DB drivers, that can be vaults or even local files. I decided to let rows to be duplicated, al least for current API version.

UPD
@anyone
Ohh, i feel me so stupid. I forgot to include important patch in this release. Just tested published version and get thousand of erros... *facepalm* If you got problems already, download this file please, until .zip not updated.

UPD
Problem solved. Attachement removed. You may download full package.
Thanx to Arkshine.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|

Last edited by Shadows In Rain; 03-06-2011 at 04:51.
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-06-2011 , 07:42   Re: AnyMAL — rapid development suite
Reply With Quote #17

AnyMAL MM.

What is it?
This plugin provides predefined Main Menu, based on Menu Builder. Main Menu created without navigation, with two predefined submenus: admin access and options. Both submenus with navigation and will be not shown if no items injected into them.

How to use.
MM provides all required menu handles via API. Menus ready to be used just like any public menu (see MB ducumentation).

Related files
anymal_mm*

Notes
  • Use IPM if you plan to use this API during initiallization time.
  • Don't forget about other plugins, that may want to use main menu slots.
  • Check number if already injected into main menu items. If your item injects over last possible (#7), your plugin will cause bugs.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-06-2011 , 16:48   Re: AnyMAL — rapid development suite
Reply With Quote #18

Update report: v0.1.01
  • Addons: minor rebalance.
  • Littliest bugfixes.
  • Fixed trouble with MySQL driver, that causes driver unusable.
  • Improved responsibility of Menu Builder, delay now realized with hooking and then unhooking PreThink. (Thank Arkshine for answering this question)
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 03-09-2011 , 18:15   Re: AnyMAL — rapid development suite
Reply With Quote #19

Update report: v0.1.02
  • Bugfix (AnyMAL IDS Common): Walking ("+speed", shift button) is silent again on maxspeeds higher than usual.
  • Fixed (AnyMAL Auth): anymal_auth_dropped() broadcasted twice after plugin_end().
  • (AnyMAL MM CS): Main Menu overrider now compatible with VGUI-menus.
  • Minor corrections.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|

Last edited by Shadows In Rain; 03-09-2011 at 20:24.
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 05-24-2011 , 17:57   Re: AnyMAL — rapid development suite
Reply With Quote #20

Project abandoned. I plan to develop better solution — AnyMAL module.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode