Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- I can make triggers that append to CMUD database, but the multiples really annoy me.
- <?xml version="1.0" encoding="ISO-8859-1" ?>
- <cmud>
- <trigger priority="10" enabled="false" copy="yes">
- <pattern>(%d) x (*) ~((%w) (%x)~)</pattern>
- <value>
- //Creating variables(taken from lines after "Brew" command)
- #var Comp_Name %2
- #var Comp_Qual %3
- #var Comp_Type %4
- // opening the database for comparison
- #SQLDB Alchemy.sqlite
- //Staring a loop to go through all the items in database
- row = %sql("Alchemy.sqlite,SELECT * FROM Name")
- //this puts it into a while loop until end of items//
- #While %sql(!@row.Eof()) {
- #if %sql(@row.Item("Name")=@Comp_Name) {#var doesexist=1}{#var doesexist=0}
- }
- #if {@doesexist=0}{ INSERT INTO Components(Name, Quality, Type)Values ( @Comp_name, @Comp_Qual, @Comp_Type)}
- //End of loop
- // that made doesexist 1 or 0 ... logical values I can work with.
- //Actually adding data if you need to. CMUD ONLY!!!
- //#If @doesexist=0 {
- //#VAR New_Comp " "
- //#ADDKEY New_Comp Name @Comp_Name
- //#ADDKEY New_comp Quality @Comp_Qual
- //#ADDKEY New_Comp Type @Comp_Type
- //#NEW Alchemy @New_Comp }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement