 |
chris123zugg Adept
Joined: 23 Aug 2013 Posts: 207
|
Posted: Sun Mar 16, 2025 4:57 pm
creating a new database part7 XD |
sooo hi there again everyone, im attempting to create a trigger that makes a database of who tapped me, and counts the times they tapped me
Then i can use this as a pure information and at a breakpoint of like 50 ill do something else....
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger name="party tap" priority="52720" copy="yes">
<pattern>(%w) taps you on the shoulder.</pattern>
<value>#var timtetaps
#if (timetaps > 0 && %ismember(%1, @taps)) {#show @taps}
#var taps %additem(%1,@taps)
#if (%ismember(%1, @taps)) {#print works for record %1 is alread in the record!} {#addkey taps name "%1"}
coffinn = (@coffinn -1)
unwrap;emote has %ansi(14)Coffin: @coffinn/@coffinnm Freezer: @freezer/25 left.%ansi(reset)</value>
</trigger>
</cmud>
|
this is the "start" i can get it to record the name of someone, but cannot for the life of me get the value to work for the person.
some help would be needed and again, much appreciated! (especially you shalimar :P)
(Shalimar edited to fix the code tags) |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4734 Location: Pensacola, FL, USA
|
Posted: Sun Mar 16, 2025 6:46 pm |
$name=%1
$count=%db(timeTaps, $name)
$count=($count+1)
#ADDKEY timeTaps $name $count
then you can reference any given person with @timeTaps.name |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4734 Location: Pensacola, FL, USA
|
Posted: Sun Mar 16, 2025 7:14 pm |
If you are looking to only allow certain names to work, you can whitelist it via the pattern instead of checking after the fact
#TR {({name1|name2|name3}) taps you on the shoulder.} {stuff}
#TR {({@tappersClub}) taps you on the shoulder.} {stuff} |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
chris123zugg Adept
Joined: 23 Aug 2013 Posts: 207
|
Posted: Sun Mar 16, 2025 7:29 pm |
you are the man shalimar:P
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4734 Location: Pensacola, FL, USA
|
Posted: Sun Mar 16, 2025 7:32 pm |
Though depending on how much info you plan on keeping about people, you might wanna nest it better:
$name=%1
$this=%db(@charData, $name)
$count=%db($this, "timesTapped")
$count=($count+1)
#ADDKEY $this timesTapped $count
#ADDKEY charData $name $this |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4734 Location: Pensacola, FL, USA
|
Posted: Sun Mar 16, 2025 7:57 pm |
as for how to best phrase the break points:
Code: |
#SWITCH ($count<50) {this}
($count<100) {that}
($count<200) {hey now}
{someone is an overachiever} |
This works because a switch only performs for the first condition it meets, so the order of the conditions matters. The overflow is optional. |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
chris123zugg Adept
Joined: 23 Aug 2013 Posts: 207
|
Posted: Sun Mar 16, 2025 7:59 pm |
nice, im gonna use this :) thanks again!
|
|
|
 |
|
|