Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Bing, Yandex

Members: 0
Guests: 5
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » General Discussions » Adding a new constate?
Forum Rules | Mark all | Recent Posts

Adding a new constate?
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 11, 2005, 11:51 am
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Yep, just like the last topic; I'd like some guidance in doing this. I've added constates in the past, but sometimes they cause issues. What would I do exactly to add a constate? Yes I know to add it in mud.h, but I would have to modify some other ifchecks at least.
       
Post is unread #2 Dec 11, 2005, 12:07 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,868
JoinedJul 26, 2005

If its something you want them to see/do before they are actually in the game toss it in before CON_PLAYING, if its something they are able to do after they are playing like editing etc... it should be after CON_PLAYING and need to be checked in verious places going by what you do/dont want to happen when in that constate. (It's been a while since i added one, but thats normaly the way i do it). Aside from that stuff and adding in the actual handling of the constate in the nanny function as well as making it so they get into and out of the constate properly its not to bad.
       
Post is unread #3 Dec 11, 2005, 12:13 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Yeah, I knew about the part where you need to add it after CON_PLAYING if it's used in the game.

You have to add a case in nanny for every constate? I wasn't sure about that one. Do you remember the definite places it needs to be checked?
       
Post is unread #4 Dec 11, 2005, 12:17 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Where a constate is checked depends on what you want to do with it. All constates need a block in the nanny function since that's what nanny does, handles connection states. What exactly are you trying to add and what should it accomplish?
       
Post is unread #5 Dec 11, 2005, 12:20 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,868
JoinedJul 26, 2005

Not right off it just depends on what it is your wanting it to do/not do.

Yea any constate is normaly handled there. the actual code that handles it can be elsewhere but you add in the constate in nanny and then send it to the actual constate handler elsewhere if you wish. If you really want to the part of the code that sends stuff to nanny could be modified to send certian constates elsewhere, but normaly everything for constates is just tossed into nanny.
       
Post is unread #6 Dec 11, 2005, 12:21 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Basically, I want a command to be used in game, where it'll take the user into a menu. From that menu, they will be able to pick different choices. I've got two constates, one for the menu, and one for the menu choice where it asks the user if they really want to pick that choice.
       
Post is unread #7 Dec 11, 2005, 12:26 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,868
JoinedJul 26, 2005

heh you would need one to also handle doing their choices (unless you toss that into the second one also).
       
Post is unread #8 Dec 11, 2005, 12:29 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

That's in the second one. While in the confirm constate, it's in a confirm function. Then it calls another function to handle the choice. Is that okay?
       
Post is unread #9 Dec 11, 2005, 12:30 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,868
JoinedJul 26, 2005

Yea that should be fine there.
       
Post is unread #10 Dec 11, 2005, 12:32 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,868
JoinedJul 26, 2005

For good ideas on how handling constates work you could always check out some of the snippets that have you add new constates.
Delete and gboards (i know at least one of the gboards adds constates)
That would at least give you some ideas about what you may/may not want to do etc... :)
       
Post is unread #11 Dec 11, 2005, 12:54 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

The CON_EDITING state is also an example of just how elaborate this can get if you want it to. You may also find guidance in the reroll snippet that utilizes the CON_ROLL_STATS state.
       
Post is unread #12 Dec 11, 2005, 12:58 pm   Last edited Dec 11, 2005, 5:04 pm by Zeno
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Ah yes, the delete snippet helps. Thanks.

What about passing variables over? I want to pass a variable over from the menu function to the confirm function, but following how delete works, it doesn't call a function. Nanny does. All delete does is set the constate.

[EDIT] I don't think I was clear. I need to pass the choice the player picked over to the confirm function somehow.

[EDIT 2] Actually, this is somewhat important, so I'll just store the variable in pfiles as LastGrant.
       
Post is unread #13 Dec 11, 2005, 5:07 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,868
JoinedJul 26, 2005

The nanny function is already capable of handling arguments, which means that you can take and pass the argument or a specified number to what ever function you create for each thing etc... Like i assume what you have in mind is to make the 2 constates and actually have it set so that based on what they do it uses different functions or it uses one other function that will handle it all but use like a variable to control what it actually does/doesn't do correct? If so thats easily possible either way.
       
Post is unread #14 Dec 12, 2005, 12:51 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Well I've got this all set, but...

How am I suppose to pass a variable through if there isn't a function call in the menu function? Like I said, all it does is set the constate, and nanny picks up the rest.
       
Pages:<< prev 1 next >>