Advertisement
JBNorton

Comp Database

Jan 24th, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. The main goal of this is to be able to type "Brew" and what ever NEW components I have on me go into a database.
  2. I can make triggers that append to CMUD database, but the multiples really annoy me.
  3.  
  4.  
  5.  
  6. <?xml version="1.0" encoding="ISO-8859-1" ?>
  7. <cmud>
  8. <trigger priority="10" enabled="false" copy="yes">
  9. <pattern>(%d) x (*) ~((%w) (%x)~)</pattern>
  10. <value>
  11. //Creating variables(taken from lines after "Brew" command)
  12. #var Comp_Name %2
  13. #var Comp_Qual %3
  14. #var Comp_Type %4
  15.  
  16. // opening the database for comparison
  17. #SQLDB Alchemy.sqlite
  18.  
  19. //Staring a loop to go through all the items in database
  20. row = %sql("Alchemy.sqlite,SELECT * FROM Name")
  21.  
  22. //this puts it into a while loop until end of items//
  23. #While %sql(!@row.Eof()) {
  24.  
  25.  
  26. #if %sql(@row.Item("Name")=@Comp_Name) {#var doesexist=1}{#var doesexist=0}
  27.  
  28. }
  29. #if {@doesexist=0}{ INSERT INTO Components(Name, Quality, Type)Values ( @Comp_name, @Comp_Qual, @Comp_Type)}
  30. //End of loop
  31.  
  32. // that made doesexist 1 or 0 ... logical values I can work with.
  33. //Actually adding data if you need to. CMUD ONLY!!!
  34. //#If @doesexist=0 {
  35. //#VAR New_Comp " "
  36. //#ADDKEY New_Comp Name @Comp_Name
  37. //#ADDKEY New_comp Quality @Comp_Qual
  38. //#ADDKEY New_Comp Type @Comp_Type
  39. //#NEW Alchemy @New_Comp }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement