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
Leopardfist
Beginner


Joined: 19 Nov 2012
Posts: 10

PostPosted: Tue Nov 20, 2012 5:32 am   

Simple Trigger to write data to database - Need Help
 
I have this simple trigger, I know all the variables are loading right, I even had it where it was writing to the DB, but I changed something, probably something minute, and now it isnt working. Any help is appreciated. Just pasting the Trigger itself, not the entire class.

Code:
<trigger priority="4240" linecolor="13" id="424">
  <pattern>You feel dizzy as time seems to spin backwards...</pattern>
  <value>#DBLOAD st
#VAR count %count(Name)
#New st Name=@Name Restats=@count Str=@Str Int=@Int Wil=@Wil Dex=@Dex Con=@Con Total=@Tot
#ECHO Stats saved to the Database! That was Restat no. @count</value>
</trigger>



Thanks for any help :)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 20, 2012 1:53 pm   
 
What exactly do you see happen when you think this should be executing? Do you not get the #ECHO? Or do you get the #ECHO but the database doesn't update? It is best when asking a question to include as much information as possible. Your code looks perfectly fine so the problem is somewhere else. We need a lot more information to figure it out.
Reply with quote
Leopardfist
Beginner


Joined: 19 Nov 2012
Posts: 10

PostPosted: Tue Nov 20, 2012 4:17 pm   
 
I'm sorry about that. The ECHO stopped as well, it doesnt echo and it doesnt write. I have checked the trigger pattern, so I assumed it had to be part of the small part of the script I Posted. But just incase here is the full script.

Also, let me explain what I am trying to do, as most of you experienced scripters could probably do it in 2 or 3 lines hehe.

I need to copy values from these two lines.

Name from: This ranks you as Khal of Illian (Level 20).

Stats from: Your base abilities are: Str:19 Int:14 Wil:16 Dex:16 Con:19.

See I cant see stats until lvl 3, then if no good I restat and level to 3 again. I want to record my stats into a database. simple as that if I wasnt a dumbarse hehe.

My database has these fields: Name - Str - Int - Wil - Dex - Con - Total (total of all 5 stats)

Now, once I got that working, I was going to try to set up a way for me to ECHO the best certain number with a command like Statecho 20 to show the 20 with the highest total. But that isnt really important right now, if I can just figure out what I did wrong hehe.

Again, THANKS for any and all assistance! I just swapped to CMud and so far love it! The more I can learn the better off I'll be :).

Here's my entire code copied from the XML page, as Im not sure how to copy the ZMud script like I could from ZMud.

Code:

<class name="StatTracker" id="29">
  <alias name="Showstats" autoappend="true" id="117">
    <value>#ECHO @Name -- with stats Str:@Str, Int:@Int, Wil:@Wil, Dex:@Dex, Con:@Con Total:@Tot</value>
  </alias>
  <var name="Name" id="239"/>
  <var name="Str" id="240"/>
  <var name="Int" id="241"/>
  <var name="Wil" id="242"/>
  <var name="Dex" id="243"/>
  <var name="Con" id="244"/>
  <var name="Tot" id="245">84</var>
  <trigger priority="4220" id="422">
    <pattern>This ranks you as &amp;Name of *</pattern>
  </trigger>
  <trigger priority="4230" id="423">
    <pattern>Your base abilities are: Str:(%d) Int:(%d) Wil:(%d) Dex:(%d) Con:(%d).</pattern>
    <value>#VAR Str %1;#VAR Int %2;#VAR Wil %3;#VAR Dex %4;#VAR Con %5;#MATH Tot %1+%2+%3+%4+%5</value>
  </trigger>
  <trigger priority="4240" id="424">
    <pattern>You feel dizzy as time seems to spin backwards...</pattern>
    <value>#New St {Name=%Name|Str=%Str|Int=%Int|Wil=%Wil|Dex=%Dex|Con=%Con|Total=%Tot};#ECHO @Name</value>
  </trigger>
</class>
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Tue Nov 20, 2012 4:41 pm   
 
If the echo is not going of, i would think the trigger is not firing...
also, you are back to using %str instead of @str
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 20, 2012 5:45 pm   
 
Yes, this version of your code has %Name, %Str, etc. instead of @Name, @Str, etc.

It is possible that this error is preventing the trigger from compiling, which would explain why you aren't getting the #Echo. Fix that error and try again.
Reply with quote
Leopardfist
Beginner


Joined: 19 Nov 2012
Posts: 10

PostPosted: Tue Nov 20, 2012 7:40 pm   
 
I finally figured out I editted it in 2 seperate instances, or characters so went from a good script to a broken script lol. Got the good one back now hehe.

Thanks for all the assistance!
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