|
skeen77 Novice
Joined: 25 Oct 2010 Posts: 31
|
Posted: Mon Feb 28, 2011 2:30 am
Identify script for database |
So, I'm a novice, currently trying to set up a script that will read identify information and plug it into the database fields I've created. I've read through some other posts, but had a question. On the mud I'm playing, the Item is line can show up like this:
Quote: |
Item is: MAGIC !VAG !MUT !CYB !INF |
Now I've set up 2 different fields, one for FLAGS (ie. MAGIC is one), and another for Class Restrictions (ie. !VAG). Since they're output on the same line, is this asking for trouble? I set up each field as an Option List, since there's only a specified number of things that can show up. Should I be somehow making a trigger for if it sees !VAG it can turn on the V option in the Option List?
Thanks. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Feb 28, 2011 3:35 am |
No real trouble, it's just that you can't do it as simply as $flags = %1.
I'd start out by pushing %1 into list format and initializing variables for the flags and class restrictions:
$itemflags = %list(%1," ")
$flags = ""
$class_restricts = ""
From there, I'd do a forall loop on $itemflags with a #switch or #case to evaluate the master list of tags:
#forall $itemflags {
#switch (%ismember(%i,"!VAG|!MUT|!CYB|!INF|etc")) {#additem $class_restricts %i}
(%ismember(%i,"MAGIC|etc")) {#additem $flags %i}
(1) {#print "unknown flag value: "%i}
} |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
skeen77 Novice
Joined: 25 Oct 2010 Posts: 31
|
Posted: Mon Feb 28, 2011 1:12 pm |
I read this last night and it made as much sense as Swedish to me, but this morning it's actually making some sense. Thanks.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|