Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
CommonCrawl, AhrefsBot, Bing, Google

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
489
3,798
19,656
607
Lorena42K

Today's Birthdays
Rane (48)
» SmaugMuds » General » Building » Create a tag/flag and store v...
Forum Rules | Mark all | Recent Posts

Create a tag/flag and store values in it?
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Mar 18, 2024 8:13 pm   
Go to the top of the page
Go to the bottom of the page

Salan
Fledgling
GroupMembers
Posts5
JoinedMar 16, 2024

 
In the 90s I remember being able to track how many times an object had been interacted with, and building an if check group off of that for increasing danger in responses. Smaug 1.4a


I can't find the mp command i must have used for that.

my testing.

MPFLAG
MPTAG

neither of these seem to work.

IFCHECK ISFLAGGED
IFCHECK ISTAGGED

nor do these seem to work with how the syntax is written in Herme's guides.
I suspect they might be for that one mud only..


Does anyone know of any way to set your own flag and assign variables (or do math with variables) in smaug 1.4a?

mpsetflag Altar == 1
if setflag(altar) == 1
Mpsetflag altar = altar + 1


Type thing.. anything like that ( even a flag i can create without math.. globally, in room, on mob, on pc, on obj?

anyone know?

Post is unread #2 Mar 21, 2024 6:38 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
I don't recall who came up with it but long ago someone created a snippet to allow something very similar to that and you could add all kinds of things in each mob program to set new variables on players etc... worked great to :)

Post is unread #3 Apr 6, 2024 12:17 am   
Go to the top of the page
Go to the bottom of the page

Salan
Fledgling
GroupMembers
Posts5
JoinedMar 16, 2024

 
Remcon said:

I don't recall who came up with it but long ago someone created a snippet to allow something very similar to that and you could add all kinds of things in each mob program to set new variables on players etc... worked great to :)


err, dang, i guess you also don't remember what it was called? hmm I'll keep looking

Post is unread #4 Jun 19, 2024 10:24 pm   Last edited Jun 19, 2024 10:26 pm by finekite
Go to the top of the page
Go to the bottom of the page

finekite
Fledgling
GroupMembers
Posts1
JoinedJun 19, 2024

 
In Smaug 1.4a, which is based on the DikuMUD codebase, handling custom flags and variables in MobProgs (MPs) requires a specific approach due to its limited scripting capabilities compared to more modern MUD engines. Here are some insights and methods that might help you achieve what you're looking for:

Setting Custom Flags
1. Using Variables for Counting:
Smaug 1.4a doesn't natively support arithmetic operations within MobProgs. Therefore, directly incrementing a variable like altar by 1 isn't straightforward. However, you can achieve a similar effect by creatively using existing flags or variables.
2. Using Custom Flags:
Smaug allows you to set custom flags on objects, mobs, rooms, or players. These flags are boolean (true/false) flags that can be manipulated within MobProgs. Here’s how you can utilize them:

Setting a Flag:

mpsetflag   == 1
Example: mpsetflag altar myflag == 1


Checking a Flag:
You can check if a flag is set using conditional statements:

if isflagged  
Example: if isflagged altar myflag


Unsetting a Flag:
You can also unset a flag:

mpsetflag   == 0
Example: mpsetflag altar myflag == 0

Workaround for Counting Interactions

To count interactions (like how many times an altar has been interacted with), you can use multiple flags to represent different states or counts:
  • Using Multiple Flags:

  • Instead of directly incrementing a variable, use different flags to represent different counts or states. For instance: coreball

  • mpsetflag altar interacted_once == 1

  • mpsetflag altar interacted_twice == 1

  • Then, use checks like:
    if isflagged altar interacted_once
    And reset flags as needed to simulate counting interactions.

    Limitations and Considerations
  • No Arithmetic Operations: Smaug 1.4a lacks support for direct variable manipulation or arithmetic operations within MobProgs. You need to creatively use flags to achieve similar effects.

  • Global vs Local Flags: Flags can be set globally (on the mob, object, room, or player) but are not directly interconnected between entities without scripting additional logic.


  • In Smaug 1.4a, managing custom flags and simulating variables requires using the mpsetflag command creatively. While direct variable manipulation isn't possible, you can achieve similar effects by setting and checking multiple flags. This approach might require more flags than modern systems would, but it remains within the capabilities of the Smaug codebase.


    Pages:<< prev 1 next >>