### Install SphereScript VS Code Extension Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Instructions for installing the SphereScript VS Code extension, either directly from the Marketplace or by building from source. This includes cloning the repository, installing dependencies, packaging, and installing the .vsix file. ```bash # Open VS Code and search for "SphereScript for SphereServer-X" # Or install via command line code --install-extension sphereserver-uo.scp-spherex ``` ```bash # Clone the repository git clone git://github.com/Sphereserver/vscode-scp-extension.git cd vscode-scp-extension # Install dependencies npm install # Package the extension npx vsce package # Install the generated .vsix file code --install-extension scp-spherex-1.0.2.vsix ``` -------------------------------- ### SphereScript Item Definition Example Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt An example of an item definition section in SphereScript, denoted by `[ITEMDEF]`. It showcases item properties such as DEFNAME, NAME, TYPE, stats (DAM, REQSTR), requirements, and event handlers like ON=@Create, ON=@Equip, and ON=@Hit. ```scp [ITEMDEF i_magic_sword] DEFNAME=i_magic_sword_of_power NAME=Enchanted Longsword TYPE=t_weapon_sword LAYER=layer_hand1 SKILLMAKE=swordsmanship 80.0, blacksmithing 90.0 DAM=15,30 REQSTR=75 TDATA1=i_ingot_iron RESOURCES=10 i_ingot_iron, 2 i_gem_ruby VALUE=5000 COLOR=colors_red RARITY=3 ON=@Create // Set magical properties MODAR=15 HITLIGHTNING=30 SLAYER=slayer_undead DURABILITY=255 ON=@Equip IF ( < 60.0) SYSMESSAGE "You lack the skill to wield this weapon!" RETURN 1 ENDIF src.emote "feels the power of the enchanted blade!" ON=@Hit IF (RAND(100) < 15) targ.damage {5 10} dam_energy effect 3,i_fx_glow,6,15,1 sound snd_spell_lightning ENDIF ``` -------------------------------- ### SphereScript Character Definition Example Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt An example of a character definition section in SphereScript, denoted by `[CHARDEF]`. It includes properties like DEFNAME, NAME, SOUND, ICON, combat stats, resistances, and AI settings, along with event handlers like ON=@Create and ON=@CreateLoot. ```scp [CHARDEF 01] DEFNAME=c_ogre NAME=#NAMES_OGRE the Ogre SOUND=427 ICON=i_pet_ogre CAN=mt_walk|mt_usehands DAM=9,11 ARMOR=32 HEIGHT=28 RESOURCES=2 i_ribs_raw FOODTYPE=15 t_meat_raw DESIRES=c_ogre, t_arock AVERSIONS=t_TRAP,r_civilization CATEGORY=Monsters SUBSECTION=Giants DESCRIPTION=Ogre ON=@Create NPC=brain_monster FAME=3000 KARMA=-3000 STR={166, 195} DEX={46, 65} INT={46, 70} MAXHITS={100, 117} RESPHYSICAL={30, 35} RESFIRE={15, 25} RESCOLD={15, 25} RESPOISON={15, 25} RESENERGY=25 MAGICRESISTANCE={55.1, 70.0} TACTICS={60.1, 70.0} WRESTLING={70.1, 80.0} ON=@CreateLoot ITEM=i_gold,{125 172} ITEM=i_club ITEM=i_treasure_map1,R99 ``` -------------------------------- ### SphereScript Comment Syntax Support Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Demonstrates the comment syntax supported by SphereScript, including single-line comments starting with '//' and multi-line block comments enclosed in '/*' and '*/'. It also shows SphereScript-specific comment blocks. ```json { "comments": { "lineComment": "//", "blockComment": [ "/*", "*/" ] } } ``` ```scp // Single line comment var.health = 100 /* * Multi-line block comment * Used for documentation */ DEFNAME=c_monster [COMMENT example] This is a SphereScript-specific comment block that can span multiple lines [/COMMENT] ``` -------------------------------- ### SCP: Accessing Item Properties and Components Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Provides examples of accessing properties of equipped items, such as weapons and armor, and retrieving information like damage, speed, durability, weight, and magical bonuses. It also shows how to check container status and player resistances. ```scp [FUNCTION f_item_properties] // Working with item properties LOCAL.weapon = IF () SYSMESSAGE "Weapon: " SYSMESSAGE "Type: " SYSMESSAGE "Damage: " SYSMESSAGE "Speed: " SYSMESSAGE "Durability: /" // Check magical properties IF () SYSMESSAGE "AR Bonus: +" ENDIF IF () SYSMESSAGE "Lightning: žių" ENDIF // Weight and value SYSMESSAGE "Weight: stones" SYSMESSAGE "Value: gold" // Container information IF () SYSMESSAGE "Container: " ENDIF ELSE SYSMESSAGE "No weapon equipped." ENDIF // Armor totals with resists SYSMESSAGE "Total AR: " SYSMESSAGE "Fire Resist: /" SYSMESSAGE "Cold Resist: /" SYSMESSAGE "Poison Resist: /" SYSMESSAGE "Energy Resist: /" ``` -------------------------------- ### SCP Control Flow: Loop Statements Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Provides examples of different loop structures: FOR (with counter), WHILE, FORCHARS (iterating nearby characters), FORCONT (iterating container items), and FORCLIENTS (iterating online clients). ```scp [FUNCTION f_loop_examples] // FOR loop with counter FOR 0 9 SYSMESSAGE "Loop iteration " ENDFOR // WHILE loop LOCAL.counter = 0 WHILE ( < 5) SERV.LOG "Counter value: " LOCAL.counter += 1 ENDWHILE // FORCHARS - loop through nearby characters FORCHARS 10 IF ( & statf_war) SYSMESSAGE "Hostile character detected: " ENDIF ENDFOR // FORCONT - loop through container items src.findlayer.layer_pack FORCONT IF ( == t_weapon_sword) SYSMESSAGE "Found sword: " ENDIF ENDFOR // FORCLIENTS - loop through all online clients FORCLIENTS sysmessage "Broadcasting to: " src.sysmessage "Server announcement!" ENDFOR ``` -------------------------------- ### SCP: Combat and Spell Triggers Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Manages combat behavior and spell interactions for a character. It handles combat start events, damage modifications during different combat phases, spell casting silences, and spell success enhancements. ```scp [CHARDEF c_boss_monster] DEFNAME=c_dragon_boss ON=@CombatStart // Triggered when combat begins EMOTE "roars with fury!" P.REGION.ALLCHARS.SYSMESSAGE The dragon has entered combat! tag.combat_phase = 1 tag.last_special = 0 ON=@Hit // Triggered when this character successfully hits target IF ( == 3) // Phase 3 - increased damage ARGN1 = * 15 / 10 // 150% damage ENDIF IF ( < /2 && == 1) // Below 50% HP - enter phase 2 tag.combat_phase = 2 EMOTE "becomes enraged!" effect 2,i_fx_explosion,10,30,1 P.REGION.ALLCHARS 3 damage {10 20} dam_fire ENDP ENDIF ON=@GetHit // Triggered before receiving damage // Check for immunity during special ability IF ( == 1) IF ( & dam_physical) SYSMESSAGE "Your attack is deflected by flames!" LOCAL.reflect = / 3 ARGO.damage dam_fire RETURN 1 // Negate damage ENDIF ENDIF ON=@SpellCast // Triggered when casting a spell IF ( > ) SYSMESSAGE "You are silenced!" RETURN 1 // Cancel spell ENDIF ON=@SpellSuccess // Triggered on successful spell cast LOCAL.spellID = IF ( == s_fireball) // Enhance fireball with boss mechanics effect 1,i_fx_curse,10,30,033FF TARG.damage {30 50} dam_fire ENDIF ``` -------------------------------- ### SCP Function: Region Control Example Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt A function demonstrating how to interact with region properties and sector data. It retrieves the current region's name and flags, accesses custom tag properties like 'tax_rate', broadcasts messages to clients within the region, and iterates through characters in a specific map sector. ```scp [FUNCTION f_region_control] // Get current region LOCAL.region = SYSMESSAGE "Current region: " // Check region flags IF ( & region_flag_guarded) SYSMESSAGE "This area is guarded." ENDIF // Region properties SYSMESSAGE "Tax rate: " // Broadcast to region P.REGION.ALLCLIENTS.SYSMESSAGE "Town announcement!" // Sector operations SERV.MAP0.SECTOR(1500,1500).ALLCHARS SYSMESSAGE "Found character: " ENDP ``` -------------------------------- ### SCP Control Flow: Switch Statements Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Illustrates the use of DOSWITCH and ENDDO for handling different skill-based actions. Includes a DEFAULT case for unknown skills. Each case can execute specific logic, like opening menus or checking for required items. ```scp [FUNCTION f_handle_skill] // Switch statement for skill-based actions DOSWITCH BEGIN SYSMESSAGE "Starting skill action..." END skill_blacksmithing SYSMESSAGE "Select an anvil to begin smithing." src.targ.p f_blacksmith_menu ENDDO skill_carpentry SYSMESSAGE "Select wood to craft items." src.targ.p f_carpenter_menu ENDDO skill_alchemy IF (!) SYSMESSAGE "You need mortar and pestle!" RETURN 1 ENDIF SYSMESSAGE "Select ingredients for alchemy." ENDDO DEFAULT SYSMESSAGE "Unknown skill selected." ENDDO ENDDO ``` -------------------------------- ### SCP Dialog Definition: Player Menu Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Defines a player menu dialog ('d_player_menu') with multiple pages and buttons. Page 0 displays static graphics and text, while Page 1 contains buttons for 'Character Stats', 'Inventory', and 'Skills'. The 'ON' blocks specify actions to trigger when buttons are pressed, such as opening other dialogs or executing functions. ```scp [DIALOG d_player_menu] 100,100 page 0 resizepic 0 0 9200 400 300 gumppictiled 10 10 380 30 2624 gumppic 15 15 9000 text 50 15 1152 0 page 1 button 20 50 4005 4007 1 0 1 text 50 50 0 1 button 20 80 4005 4007 1 0 2 text 50 80 0 2 button 20 110 4005 4007 1 0 3 text 50 110 0 3 [DIALOG d_player_menu text] Main Menu Character Stats Inventory Skills [DIALOG d_player_menu button] ON=1 // Stats button pressed DIALOG d_stats_display RETURN 1 ON=2 // Inventory button src.findlayer.layer_pack.BOUNCE RETURN 1 ON=3 // Skills button DIALOG d_skills_menu RETURN 1 ``` -------------------------------- ### SCP Menu System: Blacksmith Crafting Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Implements a blacksmith crafting menu ('m_craft_blacksmith') with options to create various items. Associated functions ('f_blacksmith_menu' and 'f_blacksmith_craft') handle displaying the menu, checking resource requirements (iron ingots), skill level, and managing the crafting process with a success chance. ```scp [MENU m_craft_blacksmith] Blacksmithing Menu ON=i_sword_katana Create Katana ON=i_sword_longsword Create Longsword ON=i_platemail_chest Create Plate Chest ON=i_ringmail_leggings Create Ring Leggings [FUNCTION f_blacksmith_menu] // Display crafting menu IF (!) SYSMESSAGE "You need iron ingots!" RETURN 1 ENDIF src.MENU m_craft_blacksmith RETURN 1 [FUNCTION f_blacksmith_craft] // ARG0 = item to craft LOCAL.itemDef = // Check skill requirement IF ( < 70.0) SYSMESSAGE "You lack the skill to craft this!" RETURN 1 ENDIF // Check resources IF (!) SYSMESSAGE "Not enough materials!" RETURN 1 ENDIF // Craft with success chance LOCAL.chance = IF ( < *10) SERV.NEWITEM NEW.cont = SYSMESSAGE "You create an exceptional item!" src.SKILLGAIN skill_blacksmithing ELSE SYSMESSAGE "You fail to craft the item." ENDIF ``` -------------------------------- ### SCP Trigger System: Common Character Triggers Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Details various character-related triggers like ON=@NPCSeeNewPlayer, ON=@Click, ON=@DClick, ON=@Hit, ON=@Death, and ON=@GetHit. These triggers define NPC behaviors in response to player interactions and combat events. ```scp [CHARDEF c_custom_guard] DEFNAME=c_town_guard NAME=Town Guard ON=@NPCSeeNewPlayer // Triggered when NPC sees a new player IF ( < -2000) SAY "Criminal scum! Guards!" call f_summon_guards ELSE SAY "Greetings, traveler." ENDIF ON=@Click // Triggered when player single-clicks the NPC RETURN 1 // Suppress default behavior ON=@DClick // Triggered when player double-clicks the NPC SYSMESSAGE "The guard nods at you." IF ( > 3) SYSMESSAGE "You are too far away." RETURN 1 ENDIF dialog d_guard_menu ON=@Hit // Triggered when NPC is hit LOCAL.attacker = IF ( != brain_guard) // Attacker is not a guard, call for help shout "To arms! We are under attack!" call f_alert_nearby_guards ENDIF ON=@Death // Triggered when NPC dies EMOTE "falls to the ground!" P.REGION.ALLCLIENTS.SYSMESSAGE A guard has been slain! ON=@GetHit // Triggered before damage calculation IF ( > 50) // Heavy damage, attempt to parry IF ( > RAND(100)) SYSMESSAGE "The guard parries your attack!" RETURN 1 // Cancel damage ENDIF ENDIF ``` -------------------------------- ### SCP Object Creation and Management Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Explains how to create and manage objects within the SCP environment. This includes functions for creating new items and NPCs, duplicating existing items, finding and modifying objects by various criteria (layer, type, ID), consuming items from containers, and referencing created objects. ```scp [FUNCTION f_object_management] // Create new item SERV.NEWITEM i_sword_katana NEW.name = "Legendary Katana" NEW.color = colors_red NEW.modar = 20 NEW.hitlightning = 35 NEW.cont = // Create with immediate reference LOCAL.sword = = 0x0481 // Spawn NPC SERV.NEWNPC c_dragon NEW.p = NEW.home = NEW.tag.spawned_by = NEW.npc = brain_monster // Duplicate item src.findlayer.layer_pack.findtype.t_potion_heal IF () DUPE 5 // Create 5 copies NEW.cont = ENDIF // Find and manipulate objects LOCAL.weapon = IF () = // Repair SYSMESSAGE "Weapon repaired!" ENDIF // Find item in container src.findlayer.layer_pack.findtype.t_reagent_garlic IF () CONSUME 1 t_reagent_garlic SYSMESSAGE "Consumed garlic reagent" ENDIF // Find by ID LOCAL.item = IF () SYSMESSAGE "Found magic key!" ENDIF ``` -------------------------------- ### SphereScript Bracket and Auto-Closing Configuration Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Details the bracket matching and auto-closing pair configurations for SphereScript in VS Code. This includes defining recognized bracket types and pairs that should automatically close upon opening. ```json { "brackets": [ ["<", ">"], ["(", ")"] ], "autoClosingPairs": [ ["<", ">"], ["{ "}"], ["[", "]"], ["(", ")"], ["\"", "\""] ["'", "'"] ], "surroundingPairs": [ ["<", ">"], ["{ "}"], ["[", "]"], ["(", ")"], ["\"", "\""] ["'", "'"] ] } ``` ```scp // Brackets auto-close and provide matching IF ( > 10) SYSMESSAGE "Target too far!" ENDIF // Surrounding pairs allow quick wrapping of selected text var.name = "Player Name" tag.inventory = {iron_sword, leather_armor} ``` -------------------------------- ### SCP Storage Types and Variables Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Demonstrates the different types of variables available in SCP scripting, including global server variables (VAR), object-persistent variables (TAG), function-scope temporary variables (LOCAL), character temporary tags (CTAG), named constants (DEF), function arguments (ARG), and object references (REF). It shows how to declare, assign, and utilize these variables. ```scp [FUNCTION f_storage_examples] // VAR - Global server variable VAR.server_uptime = VAR.total_players += 1 // TAG - Object-specific persistent variable src.tag.quest_progress = 5 src.tag.last_login = src.tag.custom_title = "The Brave" // LOCAL - Function-scope temporary variable LOCAL.damage = LOCAL.target = LOCAL.result = * 2 // CTAG - Character temporary tag (session only) src.ctag.dialog_step = 2 src.ctag.combat_bonus = 15 // DEF - Named constant definition DEF.damage_multiplier = 1.5 DEF.max_inventory = 125 LOCAL.totalDam = * // ARG - Function arguments // ARGS = full argument string // ARGN1, ARGN2, etc = numeric arguments // ARGTXT = text arguments IF ( > 0) SYSMESSAGE "Received argument: " ENDIF // REF - Object reference REF1 = REF2 = // Later access "Message sent through reference!" ``` -------------------------------- ### SCP Control Flow: Conditional Statements Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Demonstrates IF, ELIF, and ELSE statements for checking player status (health) and conditions like having a healing potion. Also shows nested and combined conditional checks using AND/OR operators for GM privileges. ```scp [FUNCTION f_check_player_status] // Comprehensive conditional logic example IF ( < /2) SYSMESSAGE "You are badly wounded!" IF ( == t_potion_heal) SYSMESSAGE "Drink your healing potion!" ELSE SYSMESSAGE "You need a healing potion!" ENDIF ELIF ( < *3/4) SYSMESSAGE "You are moderately injured." ELSE SYSMESSAGE "You are in good health." ENDIF // Multiple condition checks IF ( && >= 5) // GM with high privilege level RETURN 1 ELIF ( || >= 3) // GM or moderator RETURN 2 ELSE // Regular player RETURN 0 ENDIF ``` -------------------------------- ### SCP String Manipulation Functions Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Illustrates various built-in functions for manipulating strings in SCP scripting. This includes calculating string length, finding substrings, extracting parts of strings, reversing strings, and performing case-sensitive and case-insensitive comparisons. It also covers converting strings to upper/lower case, trimming whitespace, and using regular expressions for pattern matching. ```scp [FUNCTION f_string_examples] // String length LOCAL.text = "Hello World" LOCAL.len = > SYSMESSAGE "Length: " // Output: 11 // String position (find substring) LOCAL.pos = "World"> SYSMESSAGE "Position: " // Output: 6 // Substring extraction LOCAL.sub = > SYSMESSAGE "Substring: " // Output: "Hello" // String reverse LOCAL.reversed = > SYSMESSAGE "Reversed: " // String comparison (case-sensitive) IF ( "Hello World"> == 0) SYSMESSAGE "Strings match!" ENDIF // String comparison (case-insensitive) IF ( "hello world"> == 0) SYSMESSAGE "Strings match (case-insensitive)!" ENDIF // String to upper/lower LOCAL.upper = > LOCAL.lower = SYSMESSAGE "Upper: " // String trim LOCAL.padded = " text " LOCAL.trimmed = > // Regular expressions IF (>) SYSMESSAGE "Starts with capital letter!" ENDIF ``` -------------------------------- ### SCP Event Block: Custom Player Events Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Defines custom event blocks ('e_custom_player') to handle player interactions. It includes handlers for '@Login' (welcome messages, daily rewards), '@SkillStart' (blocking specific skills), '@SkillGain' (reporting skill improvements and mastery), '@Criminal' (flagging players as criminals), '@Kill' (tracking player kills and murderer status), and '@Resurrect' (restoring player stats upon resurrection). ```scp [EVENTS e_custom_player] // Player event handler ON=@Login // Character logs in src.sysmessage "Welcome back, !" src.tag.last_login = // Check for daily rewards IF ( < -86400) call f_daily_reward src.tag.last_daily = ENDIF ON=@SkillStart // Before skill begins LOCAL.skill = IF ( == ) SYSMESSAGE "You cannot use this skill right now!" RETURN 1 ENDIF ON=@SkillGain // After successful skill gain LOCAL.skill = LOCAL.newValue = SYSMESSAGE "Skill improved: .name> is now " IF ( >= 100.0) // Mastery achieved P.ALLCLIENTS.SYSMESSAGE has achieved mastery in .name>! ENDIF ON=@Criminal // Character flagged criminal src.emote "is now a criminal!" src.tag.criminal_time = ON=@Kill // Character kills another IF () // Player kill src.murdermark += 1 IF ( >= 5) SYSMESSAGE "You are now a murderer!" ENDIF ENDIF ON=@Resurrect // Character is resurrected src.hits = /2 src.mana = /2 src.stam = /2 src.resurrect SYSMESSAGE "You have been resurrected!" effect 3,i_fx_heal_sparkle,10,30 ``` -------------------------------- ### SCP: Container Item Triggers Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Handles interactions with containers, including opening, dropping items, and periodic checks for removal. It binds containers to players, manages gold storage, enforces item limits, and removes empty, unowned containers after a delay. ```scp [ITEMDEF i_magic_chest] DEFNAME=i_magic_storage_chest TYPE=t_container ON=@DClick // Triggered when container is opened IF ( > 2) SYSMESSAGE "That is too far away." RETURN 1 ENDIF IF ( != && != 0) SYSMESSAGE "This chest belongs to someone else!" RETURN 1 ENDIF // First time opening - set owner IF ( == 0) link = SYSMESSAGE "This chest is now bound to you." ENDIF ON=@DropOn_Item // Triggered when item is dropped into container IF ( == t_gold) LOCAL.goldAmt = ARGO.remove src.tag.chest_gold += SYSMESSAGE "Gold stored: " RETURN 1 ENDIF IF ( && >= ) SYSMESSAGE "The chest is full!" RETURN 1 ENDIF ON=@Timer // Periodic check trigger IF ( == 0 && == 0) // Empty and unowned - remove after delay IF ( > 3600) // 1 hour remove ELSE MORE1 += 60 TIMER=60 ENDIF ENDIF ``` -------------------------------- ### SCP Numeric and Math Functions Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Details the built-in numeric and mathematical functions available in SCP scripting. This includes generating random numbers, using bell curve distributions, evaluating expressions, converting hexadecimal values, performing floating-point arithmetic, and checking if a value falls within a specified range. It also shows how to perform calculations using object properties. ```scp [FUNCTION f_math_examples] // Random number generation LOCAL.dice = // 1d6 LOCAL.damage = // Random 10-30 SYSMESSAGE "Rolled: " // RANDBELL - Bell curve distribution LOCAL.bell = // Bell curve 10-20 LOCAL.stat = // EVAL - Evaluate expression LOCAL.result = // Result: 16 LOCAL.formula = / 2 + > // HVAL - Hex to decimal LOCAL.color = // Convert hex to decimal // FLOATVAL - Floating point math LOCAL.percent = / > LOCAL.bonus = LOCAL.scaled = * 100> // QVAL - Quick value (0 or 1) LOCAL.flag = > // 1 if GM, 0 otherwise // Math with properties LOCAL.avgStat = + + ) / 3> LOCAL.hpPercent = * 100) / > IF ( < 25) SYSMESSAGE "Critical health: %" ENDIF // BETWEEN - Check if value in range IF (>) SYSMESSAGE "Karma is in normal range" ENDIF ``` -------------------------------- ### SCP: Accessing and Modifying Character Properties Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Demonstrates how to access and modify various properties of a character in SphereServer. It covers displaying stats, modifying attributes, checking status flags, and retrieving location information. ```scp [FUNCTION f_character_status] // Accessing character properties and stats SYSMESSAGE "=== Character Status ===" SYSMESSAGE "Name: ()" SYSMESSAGE "Stats: STR | DEX | INT " SYSMESSAGE "Hits: /" SYSMESSAGE "Mana: /" SYSMESSAGE "Stamina: /" SYSMESSAGE "AR: | Gold: " SYSMESSAGE "Fame: | Karma: " SYSMESSAGE "Level: | Exp: " // Modify properties src.modmaxhits = 25 // Bonus max HP src.modstr = 10 // Bonus strength src.modar = 5 // Bonus armor // Check flags IF ( & statf_war) SYSMESSAGE "You are in combat mode!" ENDIF IF ( & statf_poisoned) SYSMESSAGE "You are poisoned! Poison level: " ENDIF // Movement and position SYSMESSAGE "Position: Map: " SYSMESSAGE "Region: " SYSMESSAGE "Distance from home: .distance()>" ``` -------------------------------- ### SCP Region Definition: Britain Town Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Defines a town region ('r_town_britain') with specific properties like name, group, and events. It includes guarded and safe flags, tax rate, and guard level. Event handlers for '@Enter', '@Exit', and '@RegPeriodic' manage player entry/exit messages, criminal warnings, and periodic guard summoning based on player status within the region. ```scp [REGIONTYPE r_town_britain] DEFNAME=r_britain_city NAME=Britain GROUP=Britain EVENTS=e_region_guarded,e_region_town FLAGS=region_flag_guarded|region_flag_safe // Region properties TAG.tax_rate=0.05 TAG.guard_level=3 ON=@Enter // Triggered when character enters region IF () src.sysmessage "Welcome to Britain!" IF ( < -2000) // Criminal enters town src.sysmessage "Guards are watching you..." src.tag.guard_warning = ENDIF ENDIF ON=@Exit // Triggered when character leaves region IF () src.sysmessage "You have left Britain." src.ctag.guard_warning = 0 ENDIF ON=@RegPeriodic // Periodic region tick P.ALLCHARS 100 IF ( & statf_criminal) // Check for criminals call f_summon_guards ENDIF ENDP ``` -------------------------------- ### SCP Function Definition: Custom Healing Source: https://context7.com/sphereserver/vscode-scp-extension/llms.txt Defines a custom healing function that checks the player's skill level before applying healing. It takes the amount to heal and the required skill as arguments. Returns 1 on success, 0 on failure. ```scp [FUNCTION f_custom_heal] // Custom healing function with skill check // ARGS: ARG0 = amount to heal, ARG1 = skill required LOCAL.healAmount = > LOCAL.skillReq = > IF ( < ) SYSMESSAGE "Your healing skill is insufficient!" RETURN 0 ENDIF // Calculate actual healing with randomness LOCAL.actualHeal = /2,)> src.hits += // Visual feedback src.effect 3,i_fx_heal_sparkle,6,15,0 src.sound snd_spell_heal SYSMESSAGE "You heal for hit points." RETURN 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.