Difference between revisions of "Uurdin ARedBearTest(Script)"
Jump to navigation
Jump to search
(Created page with "{{CoffeeMUDWikiBuilderTOC}} = A Red Bear Test = This script is an example of how to change a word (red) to another word (Orange) located somewhere in the display of a target....") |
|||
Line 4: | Line 4: | ||
This script is an example of how to change a word (red) to another word (Orange) located somewhere in the display of a target. | This script is an example of how to change a word (red) to another word (Orange) located somewhere in the display of a target. | ||
− | == | + | == Display Word Switch == |
<pre> | <pre> | ||
Revision as of 22:00, 1 July 2023
CoffeeMUD |
---|
Administrator Builder Player |
=CoffeeMUD Builder Information= | |||
---|---|---|---|
Basics | Praetor Player Support Commands Zapper Masks | Advanced | Races Classes Abilities Socials Scripting |
Building | Behaviors Properties Areas Rooms Exits Items Mobs | Systems | Achievements Crafting Help Info Ships Planes of Existence Quests Triumphs |
A Red Bear Test
This script is an example of how to change a word (red) to another word (Orange) located somewhere in the display of a target.
Display Word Switch
#uurdin_aredbeartest.script speech_prog p testnow mpcallfunc DisplayWordSwitch "red" "Orange" ~ function_prog DisplayWordSwitch mpsetvar $i VAR_DISPLAY_NEW mpsetvar $i VAR_DISPLAY_OLD_LENGTH $%GSTAT($i display)%.LENGTH# mpsetvar $i VAR_DISPLAY_OLD_LENGTH -- #the above must subtract 1 from length due to 0 start in loop below #mpecho length of display is: $<$i VAR_DISPLAY_OLD_LENGTH> for $0 = 0 to '$<$i VAR_DISPLAY_OLD_LENGTH>' #mpecho $0 and $%GSTAT($i display)%.$0 if eval($0 == '$<$i VAR_DISPLAY_OLD_LENGTH>') #the above if checks for the last word in the mobs display #this is the only one that will be checked using the strcontains since it ignores punctuation #and normally the last word has a period at the end. if strcontains('$%GSTAT($i display)%.$0' $g.0) mpsetvar $i VAR_DISPLAY_NEW $<$i VAR_DISPLAY_NEW> $g.1 else mpsetvar $i VAR_DISPLAY_NEW $<$i VAR_DISPLAY_NEW> $%GSTAT($i display)%.$0 endif else if eval('$%GSTAT($i display)%.$0' == $g.0) mpsetvar $i VAR_DISPLAY_NEW $<$i VAR_DISPLAY_NEW> $g.1 else if eval('$%GSTAT($i display)%.$0' == 'a') mpsetvar $i VAR_DISPLAY_NEW $<$i VAR_DISPLAY_NEW> a(n) else mpsetvar $i VAR_DISPLAY_NEW $<$i VAR_DISPLAY_NEW> $%GSTAT($i display)%.$0 endif endif endif next mpgset $i display $<$i VAR_DISPLAY_NEW> ~
Notes
.