Conversation
Fix creature skinning
Run item preverb scripts for GET and DROP
Run item preverb scripts for equipment commands
added 21 commits
August 8, 2026 15:52
… and scripted movement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Huge release here.
This PR significantly expands the LOFP engine’s support for the original script system and corrects command ordering so original game scripts can intercept actions before built-in behavior occurs.
The overall goal is to reproduce original LOFP behavior from the
.SCRdata rather than hard-code individual rooms or items.Summary
Script execution and command ordering
IFPREVERBexecutes before normal command behavior.CLEARVERBnow correctly prevents the normal command from continuing when a script has handled or cancelled the action.IFVERBexecutes afterIFPREVERBwhen the preverb does not block the command.TOUCH,CONCENTRATE,SMELL,SEARCH,GET,DROP,PUT, and existing generic item-interaction verbs.Player item scripting
RoomItemscript context is created when necessary because the legacy script engine operates on room-item-style values.ITEMVAL1throughITEMVAL5are copied back to the realInventoryItem.Adj1andAdj3.ITEMVALstate must survive one command and affect later commands.GET ordering and scripted scenery
GETso the requested object is resolved before normal pickup restrictions are applied.IFPREVERB GETnow runs before rejecting an item because it is fixed, extremely heavy, a portal, manuscript, etc.CLEARVERBfrom a GET script stops normal pickup.NEWPUTcases where a script changes the room item slice while GET is executing.DROP scripting
IFPREVERB DROPexecutes before ordinary dropping.CLEARVERBto stop the normal inventory-to-room transfer.Money dropping and pickup
MONEYitems rather than ordinary inventory objects.PUT and
IFPREVERB2IFPREVERB2 PUTto work on scripted destinations that are not necessarily ordinary containers, such as special scenery objects.CLEARVERBstops ordinary PUT when the script handled the action.IN and ON containers
INto bothINandON.PUT <item> IN <container>andPUT <item> ON <container>are parsed separately.CONTAINER IN/CONTAINER ONdefinitions must match the requested relationship.IsPut/PutInrepresentation, with the destination definition determining whether the relationship is IN or ON.LOOK and container presentation
LOOK AT <thing>so the target is resolved like examining the object rather than treatingatas part of the noun.LOOK INandLOOK ON.ITEM IN/ITEM ONdescriptions take precedence over dynamically generated content lists.Portable/container contents
InventoryItem.Contentswhen a room container is picked up.SEARCH scripting and roundtime
SEARCHnow checksIFPREVERB SEARCH -1before performing the built-in search.CLEARVERBlets the room script replace ordinary SEARCH entirely.RoundTimeandRoundTimeExpiryare maintained for SEARCH.Roundtime enforcement
E,W, etc. calldoMove()directly and bypassGO.[Wait 5 seconds...].doGo()for portal/object-based GO actions that do not necessarily use normal directional movement.EQUAL ROUNDTIME <seconds>updates the expiry time as well as the script-visible roundtime value.EQUAL ROUNDTIME 18.CONCENTRATE
CONCENTRATE <item>through normal item interaction instead of immediately returning the generic “You concentrate deeply” response.IFPREVERB/IFVERB CONCENTRATEscripts to execute.SMELL
IFVERB SMELL -1behavior without creating a special implementation for individual rooms.TOUCH /
IFTOUCHIFTOUCHsupport.CLEARVERBbehavior.Scripted state values
ITEMVALmutations now survive commands on carried items.BODYPOINTSscript assignments are clamped to the player’s valid health range instead of allowing healing above maximum Body.Evil circlet compatibility work
GAZEandCONCENTRATEcan reach the circlet’s original scripts while the item is carried/worn.ITEMVAL5changes persist and affect subsequent commands.EQUAL ROUNDTIME 18is recognized and updates player roundtime.ADD BODYPOINTSis clamped to maximum Body.IFTOUCH, alignment checks, ECHO, POSITION, andCLEARVERBpaths were exercised.PLREVENT/CONTPLREVENTexecution is not part of this implementation yet; those actions currently remain future work for true timed multi-stage scripts.Script-first architecture
resolve command/target → run matching script → CLEARVERB stops command → otherwise perform built-in behavior..SCRfiles already contain the intended behavior.Room/item movement and notifications
Direction and GO handling
doMove()so abbreviated/full compass commands cannot bypass it.doGo()for object/portal movement.UP/ABOVEandDOWN/BELOWwas cleaned up during this work.Parser/game-world support
.SCRfiles instead of reimplementing that information in command code.Original script data
Small corrections were made to:
original/scripts/DEJOBAAN.SC1original/scripts/FAYDINDR.SCRoriginal/scripts/FORESTER.SCRoriginal/scripts/ITEM1.SCRThese are tiny changes compared with the engine work: 1–3 changed lines per file.
They were committed with the corresponding parser/script compatibility work rather than constituting large rewrites of the original data.
Formatting/refactoring
Validation
Branch:
feature/script-ordering-eventsCommit:
d8da4b3 Add roundtime enforcement and script item persistence fixesLocal HEAD and remote are identical:
d8da4b3 (HEAD -> feature/script-ordering-events, origin/feature/script-ordering-events)Working tree is clean and the branch is up to date with the remote.
Commit size:
8 files changed, 1649 insertions(+), 610 deletions(-)Files changed:
engine/internal/engine/engine.goengine/internal/engine/scripts.goengine/internal/gameworld/types.goengine/internal/scriptparser/parser.gooriginal/scripts/DEJOBAAN.SC1original/scripts/FAYDINDR.SCRoriginal/scripts/FORESTER.SCRoriginal/scripts/ITEM1.SCRgo test ./...passes for the entire Go module, including:github.com/jonradoff/lofp/internal/enginego vet ./...reports one outstanding warning:internal/engine/spells.go:890:3: unreachable codeThat warning does not prevent compilation or the tests from passing and is outside the primary script-ordering work in this PR.
Known follow-up work
PLREVENT/CONTPLREVENTstill need real delayed script continuation rather than synchronous execution.The circlet’s scripted 18-second roundtime should still receive an explicit end-to-end test, although normal SEARCH/movement roundtime enforcement has been manually verified.
KILL PLAYERis recognized by the script engine but still needs correct death semantics; current testing showed the rest of the TOUCH script executing without actually reducing the player to a dead state.Open/closed and locked/unlocked item state ultimately need independent state axes. The original scripts can represent combinations such as CLOSED + UNLOCKED, while the current single
Staterepresentation cannot fully model both simultaneously.There is also one movement behavior worth regression-testing: the previous explicit sitting/lying check was removed from
doGo()during this accumulated work, so movement while sitting/lying should be confirmed to be blocked through the intended shared movement path.