qsp 1.9

qsp 1.9

Qsp 1.9 -

! Create object object 'sword' objdesc 'A sharp iron sword' objstr %str_bonus = 5 end object ! Use object @sword['objstr'] "Access property" timer 'hour_cycle' 1000 "1000ms = 1s" Trigger location !timer :

#forest *PL "Dark trees surround you." ACTIONS: "Search" : gosub 'forest_search' "Return home" : goto 'main_room' END ACTIONS

if %player_hp <= 0: killall "death" return qsp 1.9

Happy questing!

#proc_rest %player_hp = %player_max_hp *PL "You recover fully." return Part 5: Advanced QSP Features (1

#cave *PL "You see a troll." gosub 'display_troll_status' "Attack" : gosub 'attack_troll' QSP automatically saves all variables & current location. Use savegame / loadgame :

#proc_forest_search %found = rand(1,100) if %found <= 30: %player_gold += 5 *PL "You find 5 gold!" elseif %found <= 60: %damage = rand(1,6) %player_hp -= %damage *PL "A wolf bites you for <<%damage>> damage!" else: *PL "You find nothing." endif 100) if %found &lt

#cave *PL "You see a troll." if %troll_hp>0: *PL "Troll is angry." "Attack" : gosub 'attack_troll' Good (use subroutines for repeated logic):

#proc_combat %damage = %player_str - %enemy_armor if %damage < 0: %damage = 0 %enemy_hp -= %damage *PL "You deal <<%damage>> damage." return gosub 'proc_combat' Note: gosub executes the location code and returns to the line after the call. goto replaces the current location permanently. Part 5: Advanced QSP Features (1.9) 5.1 Objects Objects are like named structs/dictionaries:

Wir benutzen Cookies

Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell für den Betrieb der Seite, während andere uns helfen, diese Website und die Nutzererfahrung zu verbessern (Tracking Cookies). Sie können selbst entscheiden, ob Sie die Cookies zulassen möchten. Bitte beachten Sie, dass bei einer Ablehnung womöglich nicht mehr alle Funktionalitäten der Seite zur Verfügung stehen.