Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Newbie with scripting problem.

Newbie with scripting problem.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by NinjaKick   USA  (17 posts)  Bio
Date Fri 07 Mar 2003 07:17 AM (UTC)
Message
I don't really know how to do any scripts, but could someone give me a hand?

I wanted to make it so when I identify an item, I could save certain things into a variable



Taken from a mud I play


Quote:


You wave your arms and utter the words, 'identify'.

/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~\
| | |
| -= cyanite leg mail =- |___/
| Type armor Weight is 1 |
| Value is 0 Level is 33 |
| It is mainly composed of ceramic. |
| Extra flags none. |
| Armor class is 8 pierce, 3 bash, |
| 7 slash, and 0 vs. magic. |
| Affects hit roll by 1. |
| Affects damage roll by 2. |
| |
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/ |
| | |
\_____________________________________________________\__/




Is there a way to make it so I can have it look for affects on it, armor class, extra flags, material, level of item, item type, weight, value, and item name?

So I could do something like this for an alias

"say ident"

which would do something like this:



Quote:


sprintf( output, "%s type: %s, weight %d, value %d, level %d, material %s, extra %s, ac %d %d %d %d, affects: %s%s%s%s%s%s", item_name, type, weight, value, level, material, extras, ac_pierce, ac_bash, ac_slash, ac_magic, affect1 != NULL ? affect1:"", affect2 != NULL ? affect2:"", affect3 != NULL ? affect3:"", affect4 != NULL ? affect4:"", affect5 != NULL ? affect5:"", affect6 != NULL ? affect6:"");

do_say (output)




(Sorry for using the C language to do that, it is the only language I know)

Something to those sorts

Any help will be very appreciated.

I'm tired.
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 08 Mar 2003 08:38 PM (UTC)
Message
First I would make a trigger that matches on:


You wave your arms and utter the words, 'identify'.


I would use that trigger in a small script to enable a group of other triggers, see the function:


http://www.gammon.com.au/scripts/function.php?name=EnableTriggerGroup


Then I would make a batch of other triggers, putting them into the same group (eg. "ident" group), like this:


Type armor Weight is *
It is mainly composed of *.


Each one of those would call a small script that would capture the variable part (from the wildcard), using wildcards (1). See examples on this forum, or the supplied script file to see exactly how to do that.

When the last line appeared ("Affects damage roll by *." in your example) I would disable the trigger group, and then display all the values you found.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #2 on Sun 09 Mar 2003 09:37 AM (UTC)
Message
Are ou wanting to save the info indefinately for a database of sorts? If so a standard variable script won't quite do what you're looking for, but if all you need is to highlight certain features on the object it would be fine.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by NinjaKick   USA  (17 posts)  Bio
Date Reply #3 on Tue 11 Mar 2003 05:08 AM (UTC)
Message
I want it to be able to save it. Then when I use the alias say... idensay it would output the stuff.

Or I could do something like identell ninjakick, and it would tell the character ninjakick the stats.

Or idenauction and it would auction all the information, basicly the info for the item would be saved until mushclient/that world is closed.(if possible)

I'm tired.
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #4 on Tue 11 Mar 2003 10:43 AM (UTC)
Message
Problem with using a trigger to grab the info like this is that your variable will be reset every time you ID another item, unless you design some kind of database or array to store them in. Personally I'd just put together a database and set up a script to call obj data on command. Yes, I realize thats probably far more in depth than you wanted this project to get but doing a simple trigger, even with MC variable isn't going to do what you want unless you don't care if you can only store info for a single item.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by NinjaKick   USA  (17 posts)  Bio
Date Reply #5 on Wed 12 Mar 2003 02:48 PM (UTC)
Message
Yeah that is what I want. For it to only store one item at time.

I'm tired.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,822 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.