Raised This Month: $51 Target: $400
 12% 

Automatons


Post New Thread Reply   
 
Thread Tools Display Modes
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-01-2012 , 14:04   Re: Automatons
Reply With Quote #11

Should also be mentioned that you can add checks to states like this:

Code:
//state (condition) StateDefinition public plugin_init( ) {     get_mapname( g_MapName, charsmax( g_MapName ) )     state ( equali( g_MapName, "de_dust2" ) ) AllowChange } public plugin_end( ) < AllowChange > {     server_cmd( "changelevel aim_awp" ) // this probably doesn't work but whatever } public plugin_end( ) < > {     log_amx( "map is not de_dust2, no action taken" ) }
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-01-2012 , 16:06   Re: Automatons
Reply With Quote #12

Quote:
Originally Posted by Backstabnoob View Post
Should also be mentioned that you can add checks to states like this:
Thanks.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-01-2012 , 16:23   Re: Automatons
Reply With Quote #13

OP should have given the description of the Pawn Guide, it may help :

Quote:
state ( expression ) automaton :name

Changes the current state in the specified automaton.
The expression between parentheses is optional; if it is absent, the parentheses must be omitted as well.
The name of the automaton is optional as well, when changing the state of the default, anonymous, automaton; if the automaton name is absent, the colon (“:”) must be omitted
as well.
Below are two examples of unconditional state changes. The first is for the default automaton:
state handshake
and the second for a specific automaton:
state gps:handshake
Often, whether or not a state changes depends on parameters of the event or the condition of the automaton as a whole.
Since conditional state changes are so frequent, the condition may be in the state instruction itself. The condition follows the keyword state, between parentheses.
The state will only change if the condition is logically “true”.
The state instruction causes an implied call to the entry function ffor the indicated state —if such entry function exists.
__________________
Arkshine is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-01-2012 , 20:39   Re: Automatons
Reply With Quote #14

Quote:
Originally Posted by Seta00 View Post
Don't use this or Albernaz o Carniceiro Demoniaco will come to get you.
for those who dont know that alias of mine meant something like "Albernaz, the devilish butcher" (Albernaz is a kind of bizarre name for persons like Theodore)

Anyway everybody in the house, tell me honestly, am I a cool guy for posting this?

Last edited by joaquimandrade; 06-01-2012 at 20:40. Reason: added "everybody in the house" to make explicit that I'm not only talking to Seta00
joaquimandrade is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 06-02-2012 , 06:03   Re: Automatons
Reply With Quote #15

You're a cool guy for being cool
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-02-2012 , 11:39   Re: Automatons
Reply With Quote #16

Quote:
Originally Posted by DarkGod View Post
You're a cool guy for being cool
thanks
joaquimandrade is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-28-2012 , 01:24   Re: Automatons
Reply With Quote #17

PHP Code:
public Function(  ) <>
{
    
state Automaton1:StateEnabled
}

public Function(  ) <
Automaton1:StateEnabled>
{
    
state Automaton1:StateDisabled
}

public Function(  ) <
Automaton1:StateDisabled>
{
    
state Automaton1:StateEnabled

Anyone knows how to get rid of the default fonction ?
I mean <Automaton1:StateDisabled> and <> states have the same code, so is there a wy to combinate them ? Or is there a way to put automaton 'Automaton1' in default state so state StateDisabled would become useless ?

( <> implementation is not required for anonymous automatons )
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-28-2012 at 01:27.
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-28-2012 , 05:40   Re: Automatons
Reply With Quote #18

I believe it doesn't really make sense to explicit name for automaton in such simple model. Unless the code is driven with a [complex] bunch of events for a model which requires naming automaton (several automatons and several states for one automaton), anonymous automaton should be used.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-28-2012 , 13:12   Re: Automatons
Reply With Quote #19

I just need an answer on a question, usefullness of an example is not relevant.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-28-2012 at 13:13.
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-28-2012 , 14:42   Re: Automatons
Reply With Quote #20

1) The answer is already given in the post of the original question. Because it's non-anonymous, so, defining a name for an automaton, the fallback, which matches all others automatons, must be defined too. It makes sense and is quite logic.

2) That's not about the usefulness of an example, but the uselessness of the use of non-anonymous automatons in a basic model, here as [bad] example with 1 automaton. To have to use name for automaton means you have an advanced model which requires several automatons and several events per automaton, and having a fallback required makes sense to control properly the conditionals flow.

3) The point is : considering 1), 2), how work automaton and the very little usefulness in an AMXX plugin/environment (it would be different using the real Pawn) where model is going to be simple anyway, the question is completely irrelevant.
__________________

Last edited by Arkshine; 06-28-2012 at 14:48.
Arkshine is offline
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:53.


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