Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Mon Apr 14, 2003 7:16 am   

loot script help needed
 
#CLASS {Gemstone|LOOT}
#ALIAS loot {#TEMP {^You notice (*) ({@gems})} {#Alarm +.5 {open my @gemcontainer;get %2;put %2 in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}}}
#BUTTON 61 {Loot} {loot;look} {} {} {} {} {} {Size} {60} {17} {Pos} {1} {780} {} {} {} {} "" {} {} {} {3}
#CLASS 0

#VAR gems {despanal|blazestar|shell|orb|wand|amulet|diamond|emerald|lapis lazuli|opal|stone|mother-of-pearl|pearl|ruby|sapphire|topaz|coral|amethyst|bloodstone|garnet|gem|jasper|crystal|quartz|moonstone|tourmaline|spinel|diopside|cordierite|zircon|carbuncle|feystone|glimaerstone|hyacinth|jacinth|faenor-bloom|shard|gold ring|chalcedony|turquoise|stone|dust|obsidian|amber|garnet}

is not picking up the variable from the @gems , just sends a blank variable

look
[Observatory, Lower Level]
You notice a piece of spiderweb obsidian and a white cat (sitting).
Also here: Vespres (kneeling)
Obvious exits: up
> open my pack
get
put in my pack
Ok, it opened.
close my pack
Get what?
I could not find what you were referring to.
Ok, it shut.



Nazradin
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Tue Apr 15, 2003 9:54 pm   
 
My guess here is that you want to get the obsidian. Your problem is that you have this trigger that puts the word obsidian into the temporary variable of %1, then you try to run an alarm .5 seconds later referencing %1. This problem is that at the time that the alarm is run, the temporary %1 variable is gone.

Try this:

#CLASS {Gemstone|LOOT}
#ALIAS loot {#TEMP {^You notice (*) ({@gems})} {#var hold_gem {%1};#Alarm +.5 {open my @gemcontainer;get @help_gem;put @hold_gem in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}}}
#BUTTON 61 {Loot} {loot;look} {} {} {} {} {} {Size} {60} {17} {Pos} {1} {780} {} {} {} {} "" {} {} {} {3}
#CLASS 0

#VAR gems {despanal|blazestar|shell|orb|wand|amulet|diamond|emerald|lapis lazuli|opal|stone|mother-of-pearl|pearl|ruby|sapphire|topaz|coral|amethyst|bloodstone|garnet|gem|jasper|crystal|quartz|moonstone|tourmaline|spinel|diopside|cordierite|zircon|carbuncle|feystone|glimaerstone|hyacinth|jacinth|faenor-bloom|shard|gold ring|chalcedony|turquoise|stone|dust|obsidian|amber|garnet}



Talahaski
Processor PIII 1000
Memory 265MB
Video NVIDIA 64MB
Windows XP
Zmud Version 6.55a
Zmapper Version 1.14

http://www.dartmud.com
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Wed Apr 16, 2003 8:16 pm   
 

%1 was wrong , with (*) should be using %2 for (@gems) but its still not working

#CLASS {Gemstone|LOOT}
#ALIAS loot {#TEMP {^You notice (*) ({@gems})} {open my @gemcontainer;get %2;put %2 in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}}
#BUTTON 65 {Loot} {loot;look} {} {} {} {} {} {Size} {60} {17} {Pos} {1} {780} {} {} {} {} "" {} {} {} {3}
#CLASS 0

out put is

with no @gems in the room

look
[Observatory, Lower Level]
You notice a sky-blue glaes scarab.
Also here: Vespres (kneeling), Wakim
Obvious exits: up

and with @gems in rooms

look
[Observatory, Lower Level]
You notice a dragonseye sapphire and a sky-blue glaes scarab.
Also here: Vespres (kneeling), Wakim
Obvious exits: up
open my pack
get
put in my pack
Ok, it opened.
close my pack
> Get what?
I could not find what you were referring to.
>
Ok, it shut.


tried having the get %2 at start but made no differnce and I have removed the first alarm.

Nazradin
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Apr 16, 2003 8:33 pm   
 
I appologize, I know there was something odd with the behaviour with #EXEC in previous
versions. Hopefully someone can shed light on proper usage of this following concept for
v6.40. Here is the concept:

From the v6.56 beta's help files - its concept should apply to the public version.
quote:

Note: #ALARM does not preform any expansion on it parameters at the time of creation. If you need a parameter expanded use a syntax similar to the #EXEC example below.



#EXEC {%concat("#Alarm +.5 {open my ",@gemcontainer,";get ",%2,";put ",%2," in my ",@gemcontainer,";#Alarm +.5 {close my ",@gemcontainer,"}}")}

Ton Diening
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Fri Apr 18, 2003 5:50 am   
 
quote:

I appologize, I know there was something odd with the behaviour with #EXEC in previous
versions. Hopefully someone can shed light on proper usage of this following concept for
v6.40. Here is the concept:

From the v6.56 beta's help files - its concept should apply to the public version.
quote:

Note: #ALARM does not preform any expansion on it parameters at the time of creation. If you need a parameter expanded use a syntax similar to the #EXEC example below.



#EXEC {%concat("#Alarm +.5 {open my ",@gemcontainer,";get ",%2,";put ",%2," in my ",@gemcontainer,";#Alarm +.5 {close my ",@gemcontainer,"}}")}

Ton Diening




i tried as you posted but still have same problem. I have simplified the script as much as posiible no alarms to slow things down and still it will not insert a value into %2

#ALIAS loot {#TEMP {^You notice (*) ({@gems})} {open my @gemcontainer;get %2;put %2 in my @gemcontainer}

even removing the string to make it grab only from the text which gems are in get same result

#ALIAS loot {#TEMP {({@gems})} {open my @gemcontainer;get %1;put %1 in my @gemcontainer}}

#VAR gems {despanal|blazestar|shell|orb|amulet|diamond|emerald|lapis lazuli|opal|stone|mother-of-pearl|pearl|ruby|sapphire|topaz|coral|amethyst|bloodstone|garnet|gem|jasper|crystal|quartz|moonstone|tourmaline|spinel|diopside|cordierite|zircon|carbuncle|feystone|glimaerstone|hyacinth|jacinth|faenor-bloom|shard|gold ring|chalcedony|turquoise|stone|dust|obsidian|amber|garnet|box|chest|strongbox|coffer}

it does open and close the container just doesnt get anything.

any ideas ?

this is a perminant on or off loot buttn that works but it is not the most ideal solution

#CLASS {Gemstone|LOOT}
#TRIGGER {You notice* ({@gems})} {open my @gemcontainer;get %1;put %1 in my @gemcontainer;close my @gemcontainer}
#CLASS 0
#CLASS {Gemstone}
#BUTTON 40 {LOOT OFF} {#T+ LOOT} {LOOT ON} {#T- LOOT} {} {1} {} {Size} {72} {20} {Pos} {21} {796} {} {} {} {} "" {Inset} {} {} {3}
#CLASS 0


Nazradin
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Fri Apr 18, 2003 6:14 am   
 
well i stopped trying to use #temp and just used the button to turn the class folder on and off and that works fine

#CLASS {Gemstone|LOOT}
#BUTTON 67 {Loot} {#T+ {Gemstone|LOOT|lootget};look;#Alarm +1 {#T- {Gemstone|LOOT|lootget}}} {} {} {} {} {} {Size} {60} {17} {Pos} {1} {780} {} {} {} {} "" {} {} {} {3}
#CLASS 0

#CLASS {Gemstone|LOOT|lootget}
#TRIGGER {You notice* ({@gems})} {open my @gemcontainer;get %1;put %1 in my @gemcontainer;close my @gemcontainer}
#CLASS 0


Nazardin
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Apr 18, 2003 6:28 am   
 
In keeping with your thought pattern:

Lets troubleshoot offline (changed the alarm to +1000 to slow it down):
#ALIAS loot {#TEMP {^You notice (*) ({@gems})} {#Alarm +1000 {open my @gemcontainer;get %2;put %2 in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}}}

We type in "loot"

We force the #TEMP trigger:
#SH You notice a lovely despanal here

Checking the created alarm you notice that problem you are having; the %2 is gone.
#Alarm +1000 {open my @gemcontainer;get;put in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}

//

This is because it is being resolved in the alias. Alias loot has no value for %2 and that is what %2 turns into.

One solution would be to break the %2 up in the alias loot to hide it from the parser.

To force the value of %2 in the created the temp trigger to be used in the alarm, another variable can be created.

#ALIAS loot {#EXEC {%concat( "#TEMP {^You notice (*) ({@gems})} {#VAR GemWhich %", "2;#Alarm +1000 {open my @gemcontainer;get @GemWhich;put @GemWhich in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}}")}}

//

Probably a more useful way to do all of this with #COND and wait parameters. Another will probably suggest this.

Ton Diening

//

What Lightbulb said below ^_^
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 18, 2003 3:06 pm   
 
All that's necessary is to add a % sign. The first % sign gets stripped by the parser
when it parses the alias. The second is left for the trigger.
#ALIAS loot {#TEMP {^You notice (*) ({@gems})} {#Alarm +.5 {open my @gemcontainer;get %%2;put %%2 in my @gemcontainer;#Alarm +.5 {close my @gemcontainer}}}}

LightBulb
Advanced Member
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net