{"id":239,"date":"2026-08-13T16:22:07","date_gmt":"2026-08-13T14:22:07","guid":{"rendered":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/chapter\/gamipress-rezept-counter\/"},"modified":"2026-08-13T16:27:43","modified_gmt":"2026-08-13T14:27:43","slug":"gamipress-rezept-counter","status":"publish","type":"chapter","link":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/chapter\/gamipress-rezept-counter\/","title":{"raw":"GamiPress Rezept: Counter","rendered":"GamiPress Rezept: Counter"},"content":{"raw":"\n<h2>Idee<\/h2>\nEinen Counter implementieren der die Klicks auf einen GamiPress-Button z\u00e4hlt. Es soll drei Buttons geben, Count UP, Count DOWN und Reset. Der Counter wird unterhalb der Buttons angezeigt.\n<h3>Ben\u00f6tigte GamiPress Elemente und Add-ons<\/h3>\n<ul>\n \t<li><a href=\"https:\/\/gamipress.com\/docs\/getting-started\/points-types\/\" target=\"_blank\" rel=\"noopener\">GamiPress Point Types<\/a><\/li>\n \t<li><a href=\"https:\/\/gamipress.com\/add-ons\/button\/\" target=\"_blank\" rel=\"noopener\">GamiPress Button<\/a><\/li>\n<\/ul>\n<h2>Quellcode<\/h2>\nDer folgende Quellcode kann auf einer Buchseite eingef\u00fcgt werden. Damit werden drei Buttons erzeugt und der aktuelle Wert des Counters angezeigt. Jedem Button wird eine <strong>id<\/strong> zugewiesen. \u00dcber diese ids wird der Counter ver\u00e4ndert. Die letzte Zeile des Quellcodes gibt denn aktuellen Wert des Counters vom Typ counter-1 aus. Der Counter selbst wird mit GamiPress Point Types erstellt. Hier im Beispiel wurde der <strong>Point Type<\/strong> counter-1 genannt, wie im Screenshot weiter unten ersichtlich. \u00dcber <strong>Automatic Points Awards<\/strong> wird gesteuert wie man diese Punkte hoch- und runterz\u00e4hlt, und resetet. Im vorliegenden Fall wird bei dr\u00fccken mit id counter-1-up hoch- und mit id counter-1-down runtergez\u00e4hlt. mit reset-counters werden 999'999 Punkte abgezogen, also auf Null gesetzt, da es keine negativen Punktzahlen geben kann.\n\n[code]\n[[gamipress_button type=\"submit\" label=\"Count UP\" id=\"counter-1-up\" class=\"button call-to-action\"]]\n[[gamipress_button type=\"submit\" label=\"Count DOWN\" id=\"counter-1-down\" class=\"button call-to-action\"]]\n[[gamipress_button label=\"Reset\" type=\"reset\" id=\"reset-counters\" class=\"button call-to-action\"]]\nScore: [[gamipress_user_points type=\"counter-1\" thumbnail=\"yes\" label=\"no\" current_user=\"yes\" inline=\"yes\" columns=\"2\" columns_small=\"1\" layout=\"left\" align=\"none\" wpms=\"no\"]] Punkte\n[\/code]\n\n<a href=\"https:\/\/zuugs.hfh.ch\/lehrszenarien\/wp-content\/uploads\/sites\/2\/2024\/01\/GamiPress-Counter-Points-Config.png\"><img class=\"alignnone wp-image-238 size-large\" src=\"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1.png\" alt=\"\" width=\"1024\" height=\"683\"><\/a>\n<h2>Demo<\/h2>\n<div style=\"display: flex; column-gap: 1rem; row-gap: 1rem; flex-wrap: wrap;\">\n<div>[gamipress_button type=\"submit\" label=\"Count UP\" id=\"counter-1-up\" class=\"button call-to-action\"]<\/div>\n<div>[gamipress_button type=\"submit\" label=\"Count DOWN\" id=\"counter-1-down\" class=\"button call-to-action\"]<\/div>\n<div>[gamipress_button label=\"Reset\" type=\"reset\" id=\"reset-counter-1\" class=\"button call-to-action\"]<\/div>\nScore: [gamipress_user_points type=\"counter-1\" thumbnail=\"yes\" label=\"no\" current_user=\"yes\" inline=\"yes\" columns=\"2\" columns_small=\"1\" layout=\"left\" align=\"none\" wpms=\"no\"] Punkte\n<\/div>\n","rendered":"<h2>Idee<\/h2>\n<p>Einen Counter implementieren der die Klicks auf einen GamiPress-Button z\u00e4hlt. Es soll drei Buttons geben, Count UP, Count DOWN und Reset. Der Counter wird unterhalb der Buttons angezeigt.<\/p>\n<h3>Ben\u00f6tigte GamiPress Elemente und Add-ons<\/h3>\n<ul>\n<li><a href=\"https:\/\/gamipress.com\/docs\/getting-started\/points-types\/\" target=\"_blank\" rel=\"noopener\">GamiPress Point Types<\/a><\/li>\n<li><a href=\"https:\/\/gamipress.com\/add-ons\/button\/\" target=\"_blank\" rel=\"noopener\">GamiPress Button<\/a><\/li>\n<\/ul>\n<h2>Quellcode<\/h2>\n<p>Der folgende Quellcode kann auf einer Buchseite eingef\u00fcgt werden. Damit werden drei Buttons erzeugt und der aktuelle Wert des Counters angezeigt. Jedem Button wird eine <strong>id<\/strong> zugewiesen. \u00dcber diese ids wird der Counter ver\u00e4ndert. Die letzte Zeile des Quellcodes gibt denn aktuellen Wert des Counters vom Typ counter-1 aus. Der Counter selbst wird mit GamiPress Point Types erstellt. Hier im Beispiel wurde der <strong>Point Type<\/strong> counter-1 genannt, wie im Screenshot weiter unten ersichtlich. \u00dcber <strong>Automatic Points Awards<\/strong> wird gesteuert wie man diese Punkte hoch- und runterz\u00e4hlt, und resetet. Im vorliegenden Fall wird bei dr\u00fccken mit id counter-1-up hoch- und mit id counter-1-down runtergez\u00e4hlt. mit reset-counters werden 999&#8217;999 Punkte abgezogen, also auf Null gesetzt, da es keine negativen Punktzahlen geben kann.<\/p>\n<p><code><br \/>\n[[gamipress_button type=\"submit\" label=\"Count UP\" id=\"counter-1-up\" class=\"button call-to-action\"]]<br \/>\n[[gamipress_button type=\"submit\" label=\"Count DOWN\" id=\"counter-1-down\" class=\"button call-to-action\"]]<br \/>\n[[gamipress_button label=\"Reset\" type=\"reset\" id=\"reset-counters\" class=\"button call-to-action\"]]<br \/>\nScore: [[gamipress_user_points type=\"counter-1\" thumbnail=\"yes\" label=\"no\" current_user=\"yes\" inline=\"yes\" columns=\"2\" columns_small=\"1\" layout=\"left\" align=\"none\" wpms=\"no\"]] Punkte<br \/>\n<\/code><\/p>\n<p><a href=\"https:\/\/zuugs.hfh.ch\/lehrszenarien\/wp-content\/uploads\/sites\/2\/2024\/01\/GamiPress-Counter-Points-Config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-238 size-large\" src=\"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1.png\" alt=\"\" width=\"1024\" height=\"683\" srcset=\"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1.png 1024w, https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1-300x200.png 300w, https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1-768x512.png 768w, https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1-65x43.png 65w, https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1-225x150.png 225w, https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-content\/uploads\/sites\/233\/2026\/08\/GamiPress-Counter-Points-Config-1024x683-1-350x233.png 350w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2>Demo<\/h2>\n<div style=\"display: flex; column-gap: 1rem; row-gap: 1rem; flex-wrap: wrap;\">\n<div>[gamipress_button type=&#8220;submit&#8220; label=&#8220;Count UP&#8220; id=&#8220;counter-1-up&#8220; class=&#8220;button call-to-action&#8220;]<\/div>\n<div>[gamipress_button type=&#8220;submit&#8220; label=&#8220;Count DOWN&#8220; id=&#8220;counter-1-down&#8220; class=&#8220;button call-to-action&#8220;]<\/div>\n<div>[gamipress_button label=&#8220;Reset&#8220; type=&#8220;reset&#8220; id=&#8220;reset-counter-1&#8243; class=&#8220;button call-to-action&#8220;]<\/div>\n<p>Score: [gamipress_user_points type=&#8220;counter-1&#8243; thumbnail=&#8220;yes&#8220; label=&#8220;no&#8220; current_user=&#8220;yes&#8220; inline=&#8220;yes&#8220; columns=&#8220;2&#8243; columns_small=&#8220;1&#8243; layout=&#8220;left&#8220; align=&#8220;none&#8220; wpms=&#8220;no&#8220;] Punkte\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Idee Einen Counter implementieren der die Klicks auf einen GamiPress-Button z\u00e4hlt. Es soll drei Buttons geben, Count UP, Count DOWN und Reset. Der Counter wird unterhalb der Buttons angezeigt. Ben\u00f6tigte GamiPress Elemente und Add-ons GamiPress Point Types GamiPress Button Quellcode Der folgende Quellcode kann auf einer Buchseite eingef\u00fcgt werden. Damit werden drei Buttons erzeugt und [&hellip;]<\/p>\n","protected":false},"author":4157,"menu_order":3,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"categories":[],"chapter-type":[],"contributor":[],"license":[],"class_list":["post-239","chapter","type-chapter","status-publish","hentry"],"part":236,"_links":{"self":[{"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/pressbooks\/v2\/chapters\/239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/wp\/v2\/users\/4157"}],"version-history":[{"count":0,"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/pressbooks\/v2\/chapters\/239\/revisions"}],"part":[{"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/pressbooks\/v2\/parts\/236"}],"metadata":[{"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/pressbooks\/v2\/chapters\/239\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/wp\/v2\/media?parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/wp\/v2\/categories?post=239"},{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/pressbooks\/v2\/chapter-type?post=239"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/wp\/v2\/contributor?post=239"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/zuugs.hfh.ch\/h5pgamipresslookbook\/wp-json\/wp\/v2\/license?post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}