|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Sat Oct 02, 2010 4:57 pm
Automated Adding of Items |
Now that I have the scripts in place to auto sell items, it has become tedious, and annoying to have to add values to multiple different lists to enable the matching of another item. A long time ago when I first stated using zmud someone gave me a script that when an item had an identification spell cast on it all the values from that spell would appear in a editable menu box. I am not sure how he made that happen, but I would like to do something like that with the selling if items. I am fairly certain I can code all of this, but I do not know where to start with the editable pop up menu. As a base case consider the
when I sell one to the shop the response is
You sell a sword of a hero for 10 silver and 56 gold pieces.
So I can match that with a trigger, then have the logic of the trigger check the list of weapons and armor for a match, if none is found, then I would like to have a menu pop up with that value, the last command issued (the sell command) and maybe a check box that has the possible lists the value should be added to.
I have done a little reading on the menus, but I do not see a way to make them editable, is that even an option anymore? |
|
_________________ <Clever text here> |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Mon Oct 04, 2010 5:33 am |
Sounds like maybe you are looking for the #pick and #prompt commands.
#pick will display a selectable menu list.
#prompt will display a pop-up box you can type in a new value for the variable it is tied to. |
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Mon Oct 04, 2010 6:43 am |
Oh man that is EXACTLY what I was looking for Fizgar
|
|
_________________ <Clever text here> |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Oct 04, 2010 4:32 pm |
I don't think menus are what you are looking for.
There are several things you can do here. First, the script that you describe (that you're friend gave) sounds like it was a series of triggers to automatically add an item to the built in Database Module. As of the 3.x line, CMUD includes native SQL scripting allowing you to access SQLite or other databases from within CMUD.
Now if you want to build an interactive system, you will first want to write a script to capture and identify your inventory. Then depending on the interface you want you can use a series of #PICK, #YESNO, #MENU, #INPUT and other User Interface I/O elements to develop your system.
It is also possible, using #MXP, to develop a text-based clickable menu to do what you want by using #SUBSTITUTE and the SEND MXP tag. Example:
Code: |
#MXP This is a <send 'hello' 'help me'>test</send> |
[Edit] Man, I'm really late to this party. |
|
_________________ Asati di tempari! |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Mon Oct 04, 2010 5:49 pm |
I think #pick is the best option, however it seems to be limited to a string. The way this system is set up is there is a master list of weapons and armor, they are data records. So far I have tested
Code: |
#if (%ismember(%1,@drArmor)) { }
{ drArmor = %addkey(@drArmor,%1,%lastcom) }
|
What this does it check for the last sold item in the data record armor, if it does not exists, then it is added with the last command (which will be the sell command). What I want to do is assign the master list of data records based on the choice from the drop down.
Code: |
list %pick("p:Pick a Mode of Communication","o:1","@weapon, @armor, @whatever)
#if (%ismember(%1,@list)) { }
{ list = %addkey(@list,%1,%lastcom) }
|
The above does not work, but it seems like it should, is there a way to type cast the results of the pick?
** Edit,trying to now work with a string list, rather then data records,
#var list %pick("p:Pick a Mode of Communication","o:1","weapon, armor, whatever)
#SWITCH list=weapon... |
|
_________________ <Clever text here> |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Mon Oct 04, 2010 6:35 pm |
Solved
#VAR listName %pick("p:Type of item","o:1","weapon","armor")
#SWITCH (@listName="weapon") {
#If (%ismember(%1,@drArmor)) {}
{ drArmor = %addkey(@drArmor,%1,%lastcom) }
} (@listName="armor") {
#If (%ismember(%1,@drWeapon)) {}
{ drArmor = %addkey(@drWeapon,%1,%lastcom) } |
|
_________________ <Clever text here> |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Tue Oct 05, 2010 12:07 am |
too fubar'ed to comprehend right now, but glad you got something worked out.
|
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
|
|
|
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
|
|