PDA

View Full Version : Magic Tab



Le Jingle
03-30-2013, 08:16 PM
Hi all, I know Randoms are top priority at the moment for releasing OSR includes ASAP. However, I noticed a few people ask about magic spells, so I created a spell clicking function for users:

const
// Teleports:
LUMBRIDGE_HOME_TELEPORT = 0;
VARROCK_TELEPORT = 15;
LUMBRIDGE_TELEPORT = 18;
FALADOR_TELEPORT = 21;
TELEPORT_TO_HOUSE = 23;
CAMELOT_TELEPORT = 26;
ARDOUGNE_TELEPORT = 32;
WATCHTOWER_TELEPORT = 37;
TROLLHEIM_TELEPORT = 44;
TELEPORT_TO_APE_ATOLL = 47;

// Teleother's:
TELEOTHER_LUMBRIDGE = 54;
TELEOTHER_FALADOR = 59;
TELEOTHER_CAMELOT = 62;

// TeleBlock:
TELE_BLOCK = 60;

// Combat Elements:
WIND_STRIKE = 1;
WATER_STRIKE = 4;
EARTH_STRIKE = 6;
FIRE_STRIKE = 8;

WIND_BOLT = 10;
WATER_BOLT = 14;
EARTH_BOLT = 17;
FIRE_BOLT = 20;

WIND_BLAST = 24;
WATER_BLAST = 27;
EARTH_BLAST = 33;
FIRE_BLAST = 38;

WIND_WAVE = 45;
WATER_WAVE = 48;
EARTH_WAVE = 52;
FIRE_WAVE = 55;

// Combat Misc:
CRUMBLE_UNDEAD = 22;
IBAN_BLAST = 29;
MAGIC_DART = 31;
SARADOMIN_STRIKE = 41;
CLAWS_OF_GUTHIX = 42;
FLAMES_OF_ZAMORAK = 43;

// Skill:
ENCHANT_CROSSBOW_BOLT = 3;
LVL_1_ENCHANT = 5;
LOW_LEVEL_ALCHEMY = 13;
LVL_2_ENCHANT = 16;
SUPERHEAT_ITEM = 25;
LVL_3_ENCHANT = 28;
HIGH_LEVEL_ALCHEMY = 34;
CHARGE_WATER_ORB = 35;
LVL_4_ENCHANT = 36;
CHARGE_EARTH_ORB = 39;
CHARGE_FIRE_ORB = 46;
CHARGE_AIR_ORB = 49;
LVL_5_ENCHANT = 51;
LVL_6_ENCHANT = 61;

// Other:
CONFUSE = 2;
WEAKEN = 7;
BONES_TO_BANANAS = 9;
CURSE = 11;
BIND = 12;
TELEKINETIC_GRAB = 19;
SNARE = 30;
BONES_TO_PEACHES = 40;
VULNERABILITY = 50;
ENFEEBLE = 53;
ENTANGLE = 56;
STUN = 57;
CHARGE = 58;

(*
CastSpell
~~~~~~~~~~~

.. code-block:: pascal

procedure CastSpell(NAME: Integer);

Casts the constant name skill spell. Only valid to use constant mage spells with
a value from 0 to 62. See Constant values above for more information.

.. note::

Author: Le Jingle (Mar. 30th, 2013)
Last Modified: Never

Example:

.. code-block:: pascal

CastSpell(HIGH_LEVEL_ALCHEMY);

*)
procedure CastSpell(NAME: Integer);
begin
if (not inRange(name, 0, 62)) and (not GameTab(Tab_Magic)) then
Exit;
Mouse((570 + (name mod 7) * 24), (238 + (name div 7) * 24), 6, 6, Mouse_Left);
end;


I did have MouseOval in there instead of Mouse, but I figured it won't make much difference since the center of the spell still should allow for plenty randomness using Mouse.

On a side note, I don't have direct access to OSR, but I think I will look over the recent activity for the randoms include for OSR, seeing as I haven't much else to contribute (suggestions welcome here too ;] )

Cheers,
Lj

Edit: Didn't post in SRL-Snippets, as this is OSR related, no?

Ashaman88
03-30-2013, 08:29 PM
Correct ;)

Looks nice - would this be the magic.simba file or so?

Le Jingle
03-30-2013, 08:59 PM
Correct ;)

Looks nice - would this be the magic.simba file or so?

A snippet of it, I see the current magic.simba in the EoC srl files is lengthy but has many more things to cover. Didn't know/look in the current magic.simba to see if there's anything else I could add plus haven't looked at the in game magic tab for OSR recently either. Suppose I'll add reviewing the current magic.simba file to look over after the randoms tid-bit.

Cheers,
Lj

DannyRS
03-31-2013, 03:12 PM
We should defo look into something like this, I think I added CastSpellByNumber to gametab? Thought it may come in handy

DannyRS
04-09-2013, 06:08 PM
Le Jingle,

Any ideas for anything else useful in https://github.com/SRL/SRL-OSR/pull/115 ?

Le Jingle
04-09-2013, 06:35 PM
Le Jingle,

Any ideas for anything else useful in https://github.com/SRL/SRL-OSR/pull/115 ?

In response to your github post, you could detect which spell book the player is in (via counting the spells avaible and/or seeing what the names/last name/etc. of a spell in the particular spellbook pertains to), and go from there (w/o storing a global variable that assigns what the current spell book is).

Also, I'm not sure why you use this case statement in the GetSpellNumber function:

case Capitalize(LowerCase(Name)) of

I don't know why you call the lowercase function on a string just to capitalize it?

Also, in that same function, I would think that this would be one to halt the merging with master SRL-OSR includes because of the unfinished code portion for the other spell books.

In addition, I think that constants for each spell might be more clear and easily used rather than storing variants and string cases inside functions.
I mean this by imitating the way game tab functions use integer constants like GameTab(Tab_Inv); etc.

I don't know if I could actually contribute to creating the code for magic.simba, but I could definitely (and happily) review and what not :)

Ultimately, good job on cracking out some useful code, as I'm sure many people indeed utilize the magic tab.

Cheers again,
Lj

DannyRS
04-09-2013, 06:52 PM
In response to your github post, you could detect which spell book the player is in (via counting the spells avaible and/or seeing what the names/last name/etc. of a spell in the particular spellbook pertains to), and go from there (w/o storing a global variable that assigns what the current spell book is).

Also, I'm not sure why you use this case statement in the GetSpellNumber function:

case Capitalize(LowerCase(Name)) of

I don't know why you call the lowercase function on a string just to capitalize it?

Also, in that same function, I would think that this would be one to halt the merging with master SRL-OSR includes because of the unfinished code portion for the other spell books.

In addition, I think that constants for each spell might be more clear and easily used rather than storing variants and string cases inside functions.
I mean this by imitating the way game tab functions use integer constants like GameTab(Tab_Inv); etc.

I don't know if I could actually contribute to creating the code for magic.simba, but I could definitely (and happily) review and what not :)

Ultimately, good job on cracking out some useful code, as I'm sure many people indeed utilize the magic tab.

Cheers again,
Lj

The capitalize lowercase thing is so that people could enter ANY string and it looks neater in code (nel95 did it this way atleast), eg,

"winD sTrIke" -> "wind strike" -> "Wind Strike"

The missing spellbook stuff is still alot better than EoC broken srl5 tho?

I requested screenshots from the community so I can finish the code soon hopefully http://villavu.com/forum/showthread.php?t=101102

Le Jingle
04-09-2013, 07:03 PM
The capitalize lowercase thing is so that people could enter ANY string and it looks neater in code (nel95 did it this way atleast), eg,

"winD sTrIke" -> "wind strike" -> "Wind Strike"

The missing spellbook stuff is still alot better than EoC broken srl5 tho?

I requested screenshots from the community so I can finish the code soon hopefully http://villavu.com/forum/showthread.php?t=101102

I see, I suppose my personal opinion, (note it may be good to ask the communities or the past, previous, and current population on includes contributes) would be to exclude the strings and variants as types permitted as an argument to function params. To my logic, I would think the user/scripter would look to see what valid options they can enter in, and if there's simply magic spell name constants associated with integers, I'd see this as something more valuable to use, rather than string input. You could always make a function that converts the indexed spell to a string in a string array too. Again just me personally speaking on the topic.

I totally agree that what you have is much more valuable than the broken EoC code, but I think of the includes as something like a finished published product (granted the constant need to update to maintain this), rather than submitting in-progress code that could be determined later. (Again my personal take expressed here)

Hope the community posts some good spell book pics too,
Cheers,
Lj :)

DannyRS
04-09-2013, 07:50 PM
I see, I suppose my personal opinion, (note it may be good to ask the communities or the past, previous, and current population on includes contributes) would be to exclude the strings and variants as types permitted as an argument to function params. To my logic, I would think the user/scripter would look to see what valid options they can enter in, and if there's simply magic spell name constants associated with integers, I'd see this as something more valuable to use, rather than string input. You could always make a function that converts the indexed spell to a string in a string array too. Again just me personally speaking on the topic.

I totally agree that what you have is much more valuable than the broken EoC code, but I think of the includes as something like a finished published product (granted the constant need to update to maintain this), rather than submitting in-progress code that could be determined later. (Again my personal take expressed here)

Hope the community posts some good spell book pics too,
Cheers,
Lj :)

I can just add the constants as their correct corresponding numbers, then there's no need to convert ;)

I'll work on this stuff today :p

Le Jingle
04-09-2013, 10:19 PM
I can just add the constants as their correct corresponding numbers, then there's no need to convert ;)

I'll work on this stuff today :p

Cool :D Also, if you wouldn't mind / if you remember, might you link me to the work so my eyes can sniff it? :p I don't mean to snoop, only to try to give my perspective regardless :)

Cheers,
Lj

DannyRS
04-12-2013, 02:34 AM
Cool :D Also, if you wouldn't mind / if you remember, might you link me to the work so my eyes can sniff it? :p I don't mean to snoop, only to try to give my perspective regardless :)

Cheers,
Lj

Added ancients thanks to the guy who posted the pic, changed the InRanges, still need to type constants and get lunars ;)