Author Topic: Anti-Freezing Scripts  (Read 10601 times)

0 Members and 1 Guest are viewing this topic.

Offline erwin

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
Anti-Freezing Scripts
« on: July 08, 2008, 10:43:11 am »
I got inspired after Lionheart got frozen in the BP, and came up with these 3 scripts (attached to an object), which *should* prevent such occurences. All you need to do is to constantly type in *something* within a period of time (which you can choose), and you'll be safe. Fail to type it (which means that you're probably frozen), and you'll be killed, letting you start over again.

Here are the scripts.

First one, to let you define what time you want to give yourself.
Code: [Select]
Name: 'Slayme time trigger',  VNum: [46097], RNum: [ 1912]
Trigger Intended Assignment: Objects
Trigger Type: Command, Numeric Arg: 3, Arg list: slayme
Commands:
* Thought of by Erwin, inspiration given by Lionheart freezing in BP
* This script lets you choose from a default time, or a time which you want before you are killed
set time %arg%
eval check (%time% * (-1))
* I realized that if say, I typed slayme abcde, it would still count as > 0, since there is something
* in the argument.
* Wasn't sure if there is a simple way of finding whether the arguments you typed in are digits,
* or words, so...
* So, I figured, if it was multiplied by -1, only an argument comprised of digits will give a
* negative value.
if %arg% == default
  set time 9
  %echo% Default time set, you will be killed if you do not respond within the period of 130 seconds.
  global time
  unset num
elseif %arg% > 0 && %check% < 0
  * Hence here the check
  set time %arg%
  global time
  eval realtime (13 * (%arg% + 1) )
  %echo% Time set. You will be killed if you do not respond within the period of %realtime% seconds.
  unset num
else
  %echo% Invalid time, please select either default or a positive number of at least 1.
endif

Second one, a random trigger, which counts down

Code: [Select]
Name: 'random slay trigger',  VNum: [46098], RNum: [ 1913]
Trigger Intended Assignment: Objects
Trigger Type: Random, Numeric Arg: 100, Arg list: None
Commands:
* Thought of by Erwin, inspiration given by Lionheart freezing in BP
* This script is the countdown process, giving 01 x warning before slay.
if %time% < 1
  set time 10
endif
if %num% < %time%
  eval num %num% + 1
  global num
elseif %num% == %time%
  eval num %num% + 1
  global num
  if %self.carried_by%
    eval actor %self.carried_by%
    if %actor.level% > 1 && %actor.level% <= 50
      %echo% You might want to key in your code word now, or you will die in the next 13 seconds.
      %echo% You fade from sight as you blend with your surroundings.   
      * This is the trigger phrase / word. I chose this because it is well..common, and used
      * almost by everyone who doesn't want to log out when AFK.   
    endif
  endif
else
  unset num
  if %self.carried_by%
    eval actor %self.carried_by%
    if %actor.level% > 1 && %actor.level% <= 50
      %damage% %actor% 10000     
    endif
  endif
endif


And lastly...

Code: [Select]
Name: 'the anti-slayme command',  VNum: [46096], RNum: [ 1911]
Trigger Intended Assignment: Objects
Trigger Type: Command, Numeric Arg: 3, Arg list: who
Commands:
unset num
return 0

As you can see, I set my client to type 'who' to prevent me from getting kicked out.

Would appreciate any comments to help tidy / improve these scripts further :)
« Last Edit: July 08, 2008, 10:49:25 am by erwin »

Leonardo

  • Guest
Re: Anti-Freezing Scripts
« Reply #1 on: July 18, 2008, 08:09:19 pm »
Try rewriting all the 3 scripts into one using this idea:
- you don't need a random trigger to count down use a while statement
- sitting will stop the killing timer so we avoid creating a new trigger for that
- imms can have HP of 30k or more, so 10k damage won't work for everybody, I made the damage part more dynamic

Code: [Select]
*Command: Slayme - improved and simplified to only one script
set sac %send% %actor%
eval anum (%arg%*(-1))
if !%arg%
  %sac% Default slay time set to 10 seconds
  set atime 10
  global atime
elseif %anum%<0
  set atime %arg%
  global atime
else
  %sac% You must specify a time period and it must be a numeric value.
  halt
end
while %atime%>0
  eval atime %atime%-1
  global atime
  %sac% Seconds left for slay: %atime%
  %sac% If you don't want to be slayed just SIT
  wait 1s
  if %actor.pos%==sitting
  unset atime
  halt
  end
done
eval adamage %actor.hitp%+100
%damage% %actor% %adamage%

Though I don't understand why I should specify a timer, if I'm stuck I just want to get slayed immediately.
« Last Edit: July 18, 2008, 08:17:25 pm by Leonardo »

Offline erwin

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
Re: Anti-Freezing Scripts
« Reply #2 on: July 18, 2008, 10:54:49 pm »
Because you usually get stuck on command scripts, and these don't allow you to key in any commands, ie, that's why you are FROZEN in the first place, hence it has to be a (random) timer. Furthermore, command scripts with * as arg (when done improperly), takes precedence over all other command scripts, hence a random timer is needed. Once you log in with the object, it automatically has a default timer, so it's safe, if someone attaches a freezing script to the room you logged out in.

The original triggers allow it to run indefinitely, so long as you have the item (and the bonus part is you can choose your own time limit if you want to), or you can *forget* about it but it will still work. Since you can set triggers, allowing it to echo a familiar phrase: "You fade from sight as you blend with your surroundings." makes it easier to stop it from killing you (in case you idle on BP at <51.). Since it only checks if you are atlev 50 or below, it won't harass a level 51 or above too.

An example of a script which your anti-freezing script cannot evade :(
Code: [Select]
Name: 'freezing command script',  VNum: [46095], RNum: [ 1916]
Trigger Intended Assignment: Rooms
Trigger Type: Command, Numeric Arg: 100, Arg list: *
Commands:
%echo% You are frozen.
« Last Edit: July 19, 2008, 10:52:56 pm by erwin »