Questions concerning event script syntax

kpro

New member
Mar 26, 2021
11
1
0
75
I am super excited to use event scripts. However, I could use some help understanding the syntax of the below RAT script for "/at" (adding a teleport). Can someone explain the syntax of the script? I'm pretty good with programming languages if I have a reference for the syntax but I'm at a loss here.

.ADDTELEPORT = Built-in RAT command
:Private = ?
[AE00FF] = ?
Destination Added, Name =?
: = ?
{tele_dest_name} = built-in RAT variable?
, = ?
Location: = ?
{tele_dest_loc) = built-in RAT variable?
|| = ? this is means a logical OR in some languages

RAT Script: ".ADDTELEPORT:PRIVATE:[AE00FF]Destination Added, Name : {tele_dest_name}, Location: {tele_dest_loc}||[AE00FF]You are at the maxium of {tele_dest_max} teleport destinations. Either remove, or overwrite an existing destination."
 
From my understanding the double pipe || is a separator for the next logic. It separates what happens when the teleport setting was a success and where it fails.

The .ADDTELEPORT is a built in RATS command.

:Private tells RATS to send a private message to the player where :public sends a public message with say instead of sayplayer

[AE00FF] is a hex color code. Look up hex color codes (most popular in html) and you can change the color of the text that is sent to the player.

I am not sure how RATS gets those variables but you can do a test to see whats stored in the variable at the time.

Conditionals:
STARTSWITH:/testdestname

script:
say {tele_dest_name}

Then you can see if there is anything stored in it at the time. I have a feeling it stores the data in these variables when you run the command .ADDTELEPORT. Grabs your current location and puts it in Tele_dest_loc and takes the word after /at and puts it in tele_dest_name. tele_dest_max comes from your setting in the "Teleports/Misc" tab in RATS.

I am just speculating on all of this and giving a best guess since I did not write the program but I do some programming here and there.
 
Thank you. This explanation helps. I have two more questions.

In the teleport script above, the usage is "/tele location" where location is a single word supplied by the player. So how does the .ADDTELEPORT function get the user location? If the answer is that .ADDTELEPORT pulls the location from the built-in {tele_dest_name} variable, then how does the user supplied location get stored in the {tele_dest_name} in the first place?

Also I am still confused about the role of the ":" in the syntax. I saw a post on this site that stated that the colon is a delimiter for telnet, which I understand, but am still not seeing how it is used in the script syntax. In the script, a : separates the PRIVATE command from the message that the command seems to take as its input. Why is that?
 
Last edited:
Thank you. This explanation helps. I have two more questions.

In the teleport script above, the usage is "/tele location" where location is a single word supplied by the player. So how does the .ADDTELEPORT function get the user location? If the answer is that .ADDTELEPORT pulls the location from the built-in {tele_dest_name} variable, then how does the user supplied location get stored in the {tele_dest_name} in the first place?

Also I am still confused about the role of the ":" in the syntax. I saw a post on this site that stated that the colon is a delimiter for telnet, which I understand, but am still not seeing how it is used in the script syntax. In the script, a : separates the PRIVATE command from the message that the command seems to take as its input. Why is that?

When the command is ran I believe the player current position is set to that variable. Also the destination is saved at the time of command run as well which is supplied by the user running the command. This is speculation out of using the program for a while.

As far as the ":" goes, I am not sure. Something most likely with the coding of the program which I did not write.

Hope this helps.
 
The colon in this case, is also just used as a delimiter as I need some kind of delimiter in order to parse out the various values for the command. If you're overall point is that "this could have been done better", you'd be correct. ;) But, this is what I went with years ago when I started.

I did start a new version of the RAT script, but shelved it for various reasons. Partially because while not optimal, the current syntax does work. And also, there aren't a lot of people (that I'm aware of) that really get into the scripting of the events that much, that would require/want the new methods I wrote.

That doesn't mean it won't happen, or that aspects of that new design won't be added (they have/will continue to be). Part of what I'm working on are other systems I can drop into place with the current scripting, and then reuse in the new scripting. That way I can test some of the functionality/usefulness of those features, and then drop them into the new system after they've been proven, etc.
 
Trekkan, what you did is freaking AMAZING! RAT installed perfectly and works extremely well. So, I intended no criticism whatsoever. I know enough about programming to understand that you put thousands of hours into this for free on weekends and evenings.

RAT is so good I'm dying to write some scripts for it but am having a little trouble understanding the syntax. I saw that there is some if, endif logic in one of the RAT scripts that come with the program. I'd like to write a script that gives a player a gift if they type "/hordenight" but only if its on a blood moon day. Can you shed some light on how to this works.?

IF {{bloodmoon_days}} = 7
bc-give {{player_name}} foodCanChili /c=1
bc-give {{player_name}} drinkJarBoiledWater /c=1
bc-give {{player_name}} drinkCanMegaCrush /c=1
bc-give {{player_name}} medicalFirstAidKit /c=1
ENDIF
 
Thanks much! No worries BTW, I can take legit criticism, etc. I know you weren't, just saying its ok if you do at some point, because honestly, there is plenty to criticize in some areas. ;)

However, to your point. That script you're pointing out, is the syntax for the new scripting I was putting in a while back. I missed some of the events when I was removing the examples, etc.. .as they are really untested and not completed. So the backend scripting language changes I was working on is technically in the code still, but not documented, etc.

Currently, there isn't any way to do what you're asking and that's why I was working on that new version of RATScript. I mean, you MIGHT be able to get that to work with what I've left in there, but its not supported and not likely to remain working, etc.

I'd really like to revisit it at some point, but I need to complete the large overhaul I've been working on for RAT so that I can add in new functionality much easier than I can today.