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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Mon Jan 17, 2011 6:19 pm   

having problem with trigger
 
In the mud i get this output
Code:

You still need to find the following:
     A scone.
     A hamburger.
     A small dusk of timian herbs.
     Beef stew.
 populatewindow

complete 2.card
You still need to find the following:
     A cloudy glass staff.
     A head of lettuce.
     Puff of dust.
populatewindow


as you can see populatewindow shows 2 times but for the code i also need an #add to fire 2 times but it does not here is the code

Code:

<trigger name="qstart" priority="20" id="2">
  <pattern>^You still need to find the following:$</pattern>
  <value>#ALARM populate {+.5} {#show populatewindow}
#ADD questnumber 1
#ADDITEM QuestItems {"card #"@questnumber}
#if (@windowopen=1) {#clr quest} {openwindow}
#TEMP "qtemp" {^$} {#STATE qstart 0}</value>
  <trigger type="Manual">
    <pattern>^(*)$</pattern>
    <value>#if (%1=@questdone) {questitems = %addItem( card is complete, @questitems)} {questitems = %addItem( %replace(%trim( %1),.,""), @questitems)}</value>
  </trigger>
</trigger>


so im kinda dumbfounded right now as to why the #add and the #additem do not fire 2 times while the #show does ... sorry for the weird wording did not know how else to explain it
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Jan 17, 2011 8:07 pm   
 
Use %additem() instead of #additem. #additem will overwrite values instead of making duplicates. %additem will add duplicates.
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Mon Jan 17, 2011 8:44 pm   
 
the values are different, the script broke at one point and all it did was put card #1 card #2 into the string list
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jan 18, 2011 3:28 am   
 
Okay, now I'm not sure what you are saying is going on. If it put "card #1" and "card #2" into the string list, then it looks like it worked. What exactly is happening that you don't think should be?
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Tue Jan 18, 2011 4:32 am   
 
it was not putting card #2 in after the first card it would stop working ... i just stopped working on that project all together because it appears the script works fine on my cmud but if it is ran on the pro version it does not work if it helps any this is the full trigger ... btw i almost never use multi state triggers but it should be correct

Code:

<module name="vamp-quest" global="true" id="1">
  <uid>{25FAB2A6-555E-4D5B-8ACD-E5BDD9E4C33E}</uid>
  <trigger name="qstart" priority="20" id="2">
    <pattern>^You still need to find the following:$</pattern>
    <value>#ALARM populate {+.5} {#send populatewindow}
//#ADD questnumber 1
//#additem questitems %addItem("Card #"@questnumber, @questitems)
#if (@windowopen=1) {#clr quest} {openwindow}
#TEMP "qtemp" {^$} {#STATE qstart 0}</value>
    <trigger type="Manual">
      <pattern>^(*)$</pattern>
      <value>#if (%match( %1, "~[%d exp~] ~<%dhp %dm %dmv~>")) {} {#if (%1=@questdone) {questitems = %addItem( card is complete, @questitems)} {questitems = %addItem( %replace(%trim( %1),.,""), @questitems)}}</value>
    </trigger>
  </trigger>
  <trigger name="coloritem" priority="40" id="4">
    <pattern>@QuestItems</pattern>
    <value>#CW red</value>
  </trigger>
  <var name="windowopen" id="5">1</var>
  <alias name="openwindow" id="6">
    <value>#makewindow questwindow open "floating=yes|persistant|title='Quest Items'"
windowopen = 1</value>
  </alias>
  <alias name="closewindow" id="7">
    <value>#clr questwindow
#close questwindow
windowopen = 0</value>
  </alias>
  <trigger type="Command Input" id="8">
    <pattern>populatewindow</pattern>
    <value>#clr questwindow
#forall @questitems {#win questwindow %i}
#noinput</value>
  </trigger>
  <alias name="addquest" id="9">
    <value>#local $blagh $blagh2
$blagh=%1
questtime=0
questnumber=0
Questitems = %additem( %Cr" ", @questitems)
#if (%params=="1.card" || %params=="2.card" || %params=="3.card" || %params=="4.card" || %params=="5.card" || %params=="6.card" || %params=="7.card" || %params=="8.card" || %params=="9.card" || %params=="10.card") {complete %1} {#loop $blagh {
    $blagh2=%{i}
    questtime=@questtime+1
    #alarm quest%{i} {+@questtime} {addquest $blagh2.card}
    }}</value>
  </alias>
  <trigger priority="130" id="10">
    <pattern>(*) carried by (*).$</pattern>
    <value>#if (%ismember(%1,@QuestItems)) {#cw gold}</value>
  </trigger>
  <trigger priority="140" id="11">
    <pattern>You touch (*) to a quest card, and (*) vanishes!$</pattern>
    <value>#if (%ismember(%1,@QuestItems)) {#DELITEM QuestItems %1}
#clr questwindow
#forall @questitems {#win questwindow %i}</value>
  </trigger>
  <var name="questdone" id="12">This quest card has been completed.</var>
  <var name="questtime" id="13">0</var>
  <var name="QuestItems" type="StringList" id="14">
    <value>
 |
 |A scone|A hamburger|A small dusk of timian herbs|Beef stew||
 |card is complete</value>
    <json>["
 ","
 ","A scone","A hamburger","A small dusk of timian herbs","Beef stew","","
 ","card is complete"]</json>
  </var>
  <alias name="questreset" id="15">
    <value>#clr questwindow
questtime=0
questitems=%null
questnumber=0
#T- vamp-questAdd
#show All Quest information reset</value>
  </alias>
  <var name="questnumber" id="16">0</var>
  <trigger priority="200" id="20">
    <pattern>^This quest card has been completed.$</pattern>
    <value>//#ADD questnumber 1
//questitems = %addItem("Card #"@questnumber, @questitems)
questitems = %addItem("card is complete", @questitems)
#if (@windowopen=1) {#clr quest} {openwindow}
#send populatewindow</value>
  </trigger>
</module>

_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jan 18, 2011 2:03 pm   
 
This is not what you had in your initial post:
Code:
//#additem questitems %addItem("Card #"@questnumber, @questitems)

I don't think you really want both the #ADDITEM and %additem() doing the same thing.

One possible problem I see even in your original code is that you were depending on implicit concatenation. But that wouldn't explain why it adds the first item but not the second. All I can suggest offhand is experiment a bit, perhaps with #SHOW to test whether @questnumber was being updated correctly.

By the way, why are you doing #SEND populate window? It appears that all that happens is that this fires a trigger, which does some actions and fires #NOINPUT. Wouldn't this be better designed as an alias?
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Tue Jan 18, 2011 2:32 pm   
 
it would be it was originally designed as a trigger to fire off mud input, but then over time i just eventually changed it ... and the original code does not have the
Code:

//#additem questitems %addItem("Card #"@questnumber, @questitems)


because i was making changes playing with things trying to get the code working correctly ... the version i posted was around 2 versions later from where i started
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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