Razor Enhanced Basics

From UO Eventine Wiki
Revision as of 21:40, 24 June 2023 by Dramoor (talk | contribs)
Jump to navigation Jump to search

This page will add some basics to know and help when coding things in Razor Enhanced. The attempt on writing this is to make it as easy as possible to understand some things and will just give a basic example and try to not get too technical to keep learning as easy.

Indent

An Indent is a very important part of Python. Indents can be made by hitting the Tab key or space bar to create 4 empty spaces. Using Indents are required to add actions or responses to use when a query/condition is met.


EXAMPLE:

If Player.Hits < 20:
    Player.ChatSay("Health is low!")
    Misc.Pause(3500)  
Misc.Pause(50)
Misc.SendMessage("No Longer inside Query")
‎

With this above example, we can see that when the query of if your player has less than 20 hitpoints, it will say 'Health is low!" and then pause for 3.5 seconds. It will then exit what to do after as there are no more direct lines beneath that are in the same indent. This will result in a pause of 50ms and the send message "No Longer inside Query" to go if hits are 20 or over or go after the above conditions actions are finished.


Having actions for a query/condition met inside the first would require a new indent to be placed.


EXAMPLE:

If Player.Hits < 20:
    Player.ChatSay("Health is low!")
    Misc.Pause(3500)
    If Player.Stam > 200:
        Player.ChatSay("But our stamina is over 200!")
        Misc.Pause(2500)
Misc.Pause(50)
Misc.SendMessage("No Longer inside Query")
‎

With this code, we added a check to see when our hits are under 20 if our stamina is over 200. This query/condition when met will result in it having the player say "But our stamina is over 200!" and then pause for 2500. This query/condition can only be accessed if the first query/condition is met of the player's hit points being under 20.


Methods

Lists