Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Google, Yandex, DotBot

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » constant chars
Forum Rules | Mark all | Recent Posts

constant chars
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 11, 2006, 6:50 pm
Go to the top of the page
Go to the bottom of the page

thedlw

GroupMembers
Posts10
JoinedJun 10, 2006

Ok basically what i'm "trying" to do is. Without having to rewrite LOADS of code. Does anyone know of a way i can have variables be used as constants?

The basics of what i'm trying to do is i'm trying to make it so i can specify which affect i want a skill to attach to player in mud. Everything is working except for the part where i need a constant value.

Ie: char *const affectgiven;
if (xIS_SET(ch->affected_by,skill->affectgiven))
blah
the value of affectgiven is already defined.
I just need to be able to get the value out of it.

normally i'd do something like if (xIS_SET(ch->affected_by,AFF_POISON)) or whatever
if i can get this working i'll be one happy camper.
       
Post is unread #2 Dec 11, 2006, 8:21 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

I'm not quite following here. Are you trying to check for flags set by using the string name of the value? Cause if you are, stop now. The numerical checks are far more efficient. :)
       
Post is unread #3 Dec 11, 2006, 8:39 pm
Go to the top of the page
Go to the bottom of the page

kiasyn
Magician
GroupMembers
Posts121
JoinedJun 30, 2006

affect_types[affectgiven] >> 0 ?
       
Post is unread #4 Dec 11, 2006, 9:09 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

That's not going to work either Kiasyn. "affectgiven" is a string, not a numerical value. You'd need to do some kind of string comparison against the table of names for it to have a chance of working.
       
Post is unread #5 Dec 11, 2006, 9:44 pm
Go to the top of the page
Go to the bottom of the page

kiasyn
Magician
GroupMembers
Posts121
JoinedJun 30, 2006

silly c. get_affecttype( affectgiven )? >_>
       
Pages:<< prev 1 next >>