TODO: Planning and Items/Objects
nickrules
2010-08-05 09:16:54
Official list :D made by coh3n - Thanks.
- MSI_SpellToText narrowed down to F2P only spells. √
- MSI_RequiredRunes finished for F2P only spells. √
- MSI_SetupMagic
- Get skill level, make sure it's high enough to cast the required spell
- Make sure we have the required runes
- I think it'd be cool to also calculate how many spells we can cast depending on how many runes there are.
- We also need an idea for staffs.. like if we have a fire staff equipped, then we don't need fire runes.
- Staff TItems √
- Rune TItems - F2P ONLY (air, water, earth, fire, mind, body, chaos, death, cosmic. and….. I can't think of more :P)
- I don't think we need the required level or exp as those are stored in SRL's TSpell. We'll utilize this somehow.
So yeah, lots to do. :)
Somewhere, I have a log of the items needed (but it is incomplete). This needs to be completed, and probably updated. I can get to work on this soon(ish).
SCAR Code:
[LEFT]SETUP.SCAR
GLOBALS.SCAR
REQ_HIGHALCH = [COLOR=#000080]55[/COLOR]; [COLOR=#008000]//I might add a [/COLOR]
REQ_CURSE = [COLOR=#000080]19[/COLOR];
ITEMINFO.SCAR
Here [COLOR=#000000][B]is[/B][/COLOR] the DDTM [COLOR=#000000][B]for[/B][/COLOR] runes:
Code:
RUNES_AIR..RUNES_CHAOS: probably outdated
Result := [ [COLOR=#000080]912[/COLOR], [COLOR=#000080]435[/COLOR], [COLOR=#000080]912[/COLOR], [COLOR=#000080]449[/COLOR], [COLOR=#000080]919[/COLOR], [COLOR=#000080]423[/COLOR], [COLOR=#000080]898[/COLOR], [COLOR=#000080]439[/COLOR], [COLOR=#000080]926[/COLOR], [COLOR=#000080]435[/COLOR] ];
Colors: probably outdated
RUNE_AIR: Result := [COLOR=#000080]13882333[/COLOR];
RUNE_BODY: Result := [COLOR=#000080]855309[/COLOR];
RUNE_MIND: Result := [COLOR=#000080]472373[/COLOR];
RUNE_EARTH: Result := [COLOR=#000080]801369[/COLOR];
RUNE_WATER: Result := [COLOR=#000080]10164502[/COLOR];
RUNE_FIRE: Result := [COLOR=#000080]1450139[/COLOR];
RUNE_LAW: Result := [COLOR=#000080]13968158[/COLOR];
RUNE_NATURE: Result := [COLOR=#000080]1342481[/COLOR];
RUNE_CHAOS: Result := [COLOR=#000080]2005717[/COLOR];
STAFF_AIR..STAFF_FIRE:
Result := [ [COLOR=#000080]869[/COLOR], [COLOR=#000080]598[/COLOR], [COLOR=#000080]868[/COLOR], [COLOR=#000080]596[/COLOR], [COLOR=#000080]865[/COLOR], [COLOR=#000080]604[/COLOR], [COLOR=#000080]879[/COLOR], [COLOR=#000080]583[/COLOR], [COLOR=#000080]860[/COLOR], [COLOR=#000080]610[/COLOR] ];
OBJECTS.SCAR
OBJ_ENEMY_EVILMONK: [COLOR=#008000]// nickrules[/COLOR]
[COLOR=#000000][B]With[/B][/COLOR] Result [COLOR=#000000][B]Do[/B][/COLOR]
[COLOR=#000000][B]Begin[/B][/COLOR]
Name := [COLOR=#FF00FF]'Evil Monk'[/COLOR];
UpText := [COLOR=#FF00FF]'onk of Zam'[/COLOR];
Option := [COLOR=#FF00FF]'Cast'[/COLOR];
Colors := [[COLOR=#000080]10058855[/COLOR],[COLOR=#000080]8809562[/COLOR],[COLOR=#000080]7889233[/COLOR],[COLOR=#000080]10518892[/COLOR]];
Exp := [COLOR=#000080]29[/COLOR];
Tol := [COLOR=#000080]14[/COLOR];
Hue := [COLOR=#000080]0[/COLOR].[COLOR=#000080]6[/COLOR];
Sat := [COLOR=#000080]0[/COLOR].[COLOR=#000080]11[/COLOR];
FindAllColors := False;
W := [COLOR=#000080]20[/COLOR];
H := [COLOR=#000080]30[/COLOR];
Accuracy := [COLOR=#000080]10[/COLOR];
ExcludeSelf := True;
RightClickOnly := False;
Tries := [COLOR=#000080]5[/COLOR];
Anim := true;
WaitToMove := False;
BadColors := [];
BadColorTolerance := [COLOR=#000080]10[/COLOR];
[COLOR=#000000][B]End[/B][/COLOR];
[/LEFT]
Current Magic.scar(or simba, whatever floats your boat):
SCAR Code:
{==============================================================================\
| MSI Group Scripting Include |
| Magic.scar |
|==============================================================================|
| For all magic routines. |
\ _____________________________________________________________________________}
{$i SRL/SRL.scar}
{$i SRL/SRL/skill/Magic.scar}
var
RequiredRunes: array[0..(RUNE_COUNT - 1)] of Integer;
{******************************************************************************}
{ function SpellToString(Spell:integer): boolean; }
{ By: nickrules }
{ Date: 5 August 2010 }
{ Description: turns a spell into a useable string. }
{******************************************************************************}
Function SpellToStr(Spell: integer): string;
begin
case Spell of
SPELL_WIND_STRIKE : result := 'wind strike';
SPELL_WIND_BOLT : result := 'wind bolt';
SPELL_WIND_BLAST : result := 'wind blast';
SPELL_WIND_WAVE : result := 'wind wave';
SPELL_WATER_STRIKE : result := 'water strike';
SPELL_WATER_BOLT : result := 'water bolt';
SPELL_WATER_BLAST : result := 'water blast';
SPELL_WATER_WAVE : result := 'water wave';
SPELL_EARTH_STRIKE : result := 'earth strike';
SPELL_EARTH_BOLT : result := 'earth bolt';
SPELL_EARTH_BLAST : result := 'earth blast';
SPELL_EARTH_WAVE : result := 'earth wave';
SPELL_FIRE_STRIKE : result := 'fire strike';
SPELL_FIRE_BOLT : result := 'fire bolt';
SPELL_FIRE_BLAST : result := 'fire blast';
SPELL_FIRE_WAVE : result := 'fire wave';
SPELL_STATE_CONFUSE: result := 'confuse';
SPELL_STATE_WEAKE : result := 'weaken';
SPELL_STATE_CURSE : result := 'curse';
SPELL_STATE_BIND : result := 'bind';
SPELL_TELE_HOME : result := 'lumbridge home teleport';
SPELL_TELE_VARROCK : result := 'varrock teleport';
SPELL_TELE_LUMBY : result := 'lumbridge teleport';
SPELL_TELE_FALLY : result := 'falador teleport';
SPELL_ALCH_LOW : result := 'low level alchemy';
SPELL_ALCH_HIGH : result := 'high level alchemy';
SPELL_TELEGRAB : result := 'telekinetic grab';
SPELL_SUPERHEAT : result := 'superheat item';
else
MSI_SubDebug('Invalid spell. Check /msi/skill/magic.simba for a list.');
end;
end;
{******************************************************************************}
{ procedure MSI_GetRequiredRunes(Spell: Integer); }
{ By: nickrules & Coh3n }
{ Date: 5 August 2010 }
{ Description: Sets the RequiredRunes array depending on the user set spells }
{******************************************************************************}
procedure MSI_GetRequiredRunes(Spell: Integer);
begin
case Spell of
SPELL_WIND_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
end;
SPELL_WATER_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_WATER] := 1;
end;
SPELL_EARTH_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_EARTH] := 2;
end;
SPELL_FIRE_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_FIRE] := 2;
end;
SPELL_WIND_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2;
RequiredRunes[RUNE_CHAOS] := 1;
end;
SPELL_WATER_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2;
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_WATER] := 2;
end;
SPELL_EARTH_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2;
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_EARTH] := 3;
end;
SPELL_FIRE_BOLT:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_FIRE] := 4;
end;
SPELL_WIND_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_DEATH] := 1;
end;
SPELL_WATER_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_WATER] := 3;
end;
SPELL_EARTH_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_EARTH] := 4;
end;
SPELL_FIRE_BLAST:
begin
RequiredRunes[RUNE_AIR] := 4;
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_FIRE] := 5;
end;
SPELL_STATE_CONFUSE:
begin
RequiredRunes[RUNE_WATER] := 3;
RequiredRunes[RUNE_EARTH] := 2;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_WEAKE:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_MIND] := 2;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_CURSE:
begin
RequiredRunes[RUNE_WATER] := 2;
RequiredRunes[RUNE_EARTH] := 3;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_BIND:
begin
RequiredRunes[RUNE_EARTH] := 3;
RequiredRunes[RUNE_WATER] := 3;
RequiredRunes[RUNE_NATURE] := 2;
end;
SPELL_TELE_HOME:
begin
end;
SPELL_TELE_VARROCK:
begin
RequiredRunes[RUNE_FIRE] := 1;
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_TELE_LUMBY:
begin
RequiredRunes[RUNE_EARTH] := 1;
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_TELE_FALLY:
begin
RequiredRunes[RUNE_WATER] := 1;
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_ALCH_LOW:
begin
RequiredRunes[RUNE_FIRE] := 3;
RequiredRunes[RUNE_NATURE] := 1;
end;
SPELL_ALCH_HIGH:
begin
RequiredRunes[RUNE_FIRE] := 5;
RequiredRunes[RUNE_NATURE] := 1;
end;
SPELL_TELEGRAB:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_SUPERHEAT:
begin
RequiredRunes[RUNE_AIR] := 4;
RequiredRunes[RUNE_NATURE] := 1;
end;
else
MSI_SubDebug('Invalid spell in MSI_GetRequiredRunes');
end;
end;
{******************************************************************************}
{ function MSI_ItemToSpellSlot(tem, spell: integer): boolean; }
{ By: Nickrules }
{ Date: 5 August 2010 }
{ Description: Moves the item to the most ideal slot }
{******************************************************************************}
function MSI_ItemToSpellSlot(item, spell: integer): boolean;
begin
case spell of
SPELL_ALCH_LOW:
result := MSI_DragItem(item, 6);
SPELL_ALCH_HIGH:
result := MSI_DragItem(item, 15);
SPELL_SUPERHEAT:
result := MSI_DragItem(item, 13);
else
MSI_SubDebug('MSI_ItemToSpellSlot: Invalid spell');
end;
end;
{******************************************************************************}
{ function MSI_Cast(spell, which: integer; isObject: boolean): boolean; }
{ By: Nickrules & Coh3n }
{ Date: 22 August 2010 }
{ Description: Casts 'spell' on item/object 'which' }
{******************************************************************************}
function MSI_Cast(spell, which: integer; isObject: boolean): boolean;
var
s, spellName: string;
spellInfo: TSpell;
didCast: boolean;
begin
spellName := MSI_SpellToText(spell);
spellInfo := GetSpellInfo(spellName);
if (not Cast(spellName, spellInfo.autoCast) then
begin
MSI_SubDebug('Failed to cast spell: ' + spellName);
exit;
end;
if (isObject) then
begin
didCast := MSI_FindObject(MSI_Objects[which], ClickLeft);
s := MSI_Objects[which].Name;
end else
begin
didCast := MSI_ClickItem(which, ['ast']);
s := MSI_Items[which].Name;
end;
if (didCast) then
begin
Result := True;
MSI_SubDebug('Cast ' + spellName + ' on ' + s);
end else
MSI_SubDebug('Failed to cast ' + spellName + ' on ' + s);
end;
begin
SetupSRL;
ClearDebug;
end.
Awkwardsaw
2010-08-05 09:47:59
for the objects, make the player put the spell into the objects, then have them put the notes right under the spell, so it doesnt matter what they alch
Player[0].Objects := 'high alchemey'
then have a check if there actually is a note under the spell, if not, find a note, and move it where it should be :)
Coh3n
2010-08-05 10:50:40
From: Awkwardsaw
for the objects, make the player put the spell into the objects, then have them put the notes right under the spell, so it doesnt matter what they alch
Player[0].Objects := 'high alchemey'
then have a check if there actually is a note under the spell, if not, find a note, and move it where it should be :)
I don't think we would need that. For an alcher the user would just put SCRIPT_ALCHER then under objects they can put what items they want to alch. That's all that's really needed.
Awkwardsaw
2010-08-05 11:10:38
oh yes, i forgot about the script part :p
nickrules
2010-08-05 11:53:55
You sir, are an extremely smart cookie. Having trouble thinking right now, would that require any code modification?
Coh3n
2010-08-05 12:11:32
From: nickrules
You sir, are an extremely smart cookie. Having trouble thinking right now, would that require any code modification?
I don't think so, no. You will need a SpellToText function, however.
Awkwardsaw
2010-08-05 12:12:36
From: nickrules
You sir, are an extremely smart cookie. Having trouble thinking right now, would that require any code modification?
which part? :)
the note-relocater thing is easy, but its not to much of an importance i supose, since most people alch with only one stack of notes in the inventory. all you need is to add the notes to the item record, if its not there already
nickrules
2010-08-05 12:31:08
Updated the first post with new code and such.
Also, just realized, wouldn't the "SpellName" parameter need to be an integer, and then call the spell to string?
Awkwardsaw
2010-08-05 12:40:15
yes
Sir R. M8gic1an
2010-08-05 21:00:56
@Co3hn: We already have SpellToText / SpellToName / something ;) But good to see you around this area.
Guys, for setting up the alcher with everything in its right place we have two options:
function SetupAlcher: boolean;
or (and better in my opinion)
function SetupInventory(Items, Order: TIntegerArray): boolean
var i: integer;
begin
Result := true;
for i:= High(Items) DownTo 0 do
if not MSI_DragItem(Items[i], Order[i]) then
begin
Result := false;
MSI_Debug( ... )
end;
end;
function MSI_DragItem(Item, EndSpot: integer): boolean;
var
StartSpot: integer;
begin
StartSpot := MSI_FindItemSpot( MSI_LoadItem(Item) ); //we probably have something similar to this already...
DragItem(StartSpot, EndSpot);
end;
needs some checking and completing, but the idea is there… :)
~RM
marpis
2010-08-06 02:02:33
From: Rasta Magician
@Co3hn: We already have SpellToText / SpellToName / something ;) But good to see you around this area.
Guys, for setting up the alcher with everything in its right place we have two options:
function SetupAlcher: boolean;
or (and better in my opinion)
function SetupInventory(Items, Order: TIntegerArray): boolean
var i: integer;
begin
Result := true;
for i:= High(Items) DownTo 0 do
if not MSI_DragItem(Items[i], Order[i]) then
begin
Result := false;
MSI_Debug( ... )
end;
end;
function MSI_DragItem(Item, EndSpot: integer): boolean;
var
StartSpot: integer;
begin
StartSpot := MSI_FindItemSpot( MSI_LoadItem(Item) ); //we probably have something similar to this already...
DragItem(StartSpot, EndSpot);
end;
needs some checking and completing, but the idea is there… :)
~RM
The last part looks like you want to have a TItem record for every item people will alch?
Sir R. M8gic1an
2010-08-06 05:57:03
From: marpis
The last part looks like you want to have a TItem record for every item people will alch?
Humm true.
Should we find a more generic way to do it?
I'd rather not, but we can work around that. Hum..
~RM
nickrules
2010-08-06 08:01:48
From: Rasta Magician
Humm true.
Should we find a more generic way to do it?
I'd rather not, but we can work around that. Hum..
~RM
Assuming all notes are the same shape, we might be able to do something with that. or the color.
I'll check.
EDIT: Yes, a generic DTM could be used.
Ran a little script to test, and it found 4 out of 4 notes in my inventory
Also, why is a generic function not wanted?
–First post code updated–
Sir R. M8gic1an
2010-08-06 08:06:29
From: nickrules
Assuming all notes are the same shape, we might be able to do something with that. or the color.
I'll check.
My question was more of Withdrawing the correct items to alch from the bank.
I don't find it too troublesome to add the TItem records, but I do see where marpis is coming from.
~RM
nickrules
2010-08-06 08:45:37
Hadn't thought of that.
Gonna check something
e: yup, i thought so. The little picture of the item on the not has a black outline around it. and this outline is the same color as the actual note/item outline color (as in, the inner outline, and the outer outline were both 131072). Blacklists perhaps?
Oh, i just realized, this would still required a TItem…. hmmm…
Coh3n
2010-08-06 11:12:58
From: Rasta Magician
@Co3hn: We already have SpellToText / SpellToName / something ;) But good to see you around this area.
~RM
Where? :o
From: Rasta Magician
My question was more of Withdrawing the correct items to alch from the bank.
I don't find it too troublesome to add the TItem records, but I do see where marpis is coming from.
~RM
If we wanted to withdraw items from the bank, we would need a record for literally every item since a user could alch whatever they want. I don't think it would be that big of deal if the user just started with everything they want to alch in their inventory, then we have the script click all the DTMs of the notes.
nickrules
2010-08-06 15:42:59
From: Coh3n
Where? :o
If we wanted to withdraw items from the bank, we would need a record for literally every item since a user could alch whatever they want. I don't think it would be that big of deal if the user just started with everything they want to alch in their inventory, then we have the script click all the DTMs of the notes.
The SpellToString can be found in the first post (second function, i
think).
I have to agree with coh3n, or we could just do a few items which are comonly alched battlestaves, yew longs, etc.
After all, no sensible person would alch random items worth like nothing….
Coh3n
2010-08-06 15:49:50
From: nickrules
The SpellToString can be found in the first post (second function, i think).
Wow, completely missed it the first time I looked. :duh:
marpis
2010-08-06 16:02:12
Let's set it to alch everything in inventory.
Instructions: Have nothing but runes and the items you wish to alch in your inventory!
and then make it drag the items to slot X (the one closest to the alch symbol) and alch everything.
Sir R. M8gic1an
2010-08-06 16:10:24
I'd agree with Coh3n if I was thinking of a simple alcher. I'd envision the kind of thing that could go from making steel -> making plates -> alching, which would require the Item records.
The reason for this is (paraphrasing Fawki) "Isn't SRL all about surviving in Runescape, with one massive joint script?"
And so I would picture something that can switch between scripts. And for this to happen, the script would have to be able to set itself up, run and "close itself up".
~RM
mormonman
2010-08-06 16:12:21
From: Rasta Magician
"Isn't SRL all about surviving in Runescape, with one massive joint script?"
hmm…
| |
| |
\ /
nickrules
2010-08-06 16:32:04
From: Rasta Magician
I'd agree with Coh3n if I was thinking of a simple alcher. I'd envision the kind of thing that could go from making steel -> making plates -> alching, which would require the Item records.
The reason for this is (paraphrasing Fawki) "Isn't SRL all about surviving in Runescape, with one massive joint script?"
And so I would picture something that can switch between scripts. And for this to happen, the script would have to be able to set itself up, run and "close itself up".
~RM
In that case, anything made by MSI would already have a TItem, then, it would just be a matter of withdrawing as a note, and then just alching a generic notes TItem/DTM.
Coh3n
2010-08-06 17:36:11
From: Rasta Magician
I'd agree with Coh3n if I was thinking of a simple alcher. I'd envision the kind of thing that could go from making steel -> making plates -> alching, which would require the Item records.
The reason for this is (paraphrasing Fawki) "Isn't SRL all about surviving in Runescape, with one massive joint script?"
And so I would picture something that can switch between scripts. And for this to happen, the script would have to be able to set itself up, run and "close itself up".
~RM
This way users would only be able to alch what we've added, which isn't a big deal really. Not like it's hard to add items.
Blumblebee
2010-08-06 21:41:56
I don't understand why you need to withdraw stuff to high alch items. A simple ExistsItem(x) for the specified slot should work just fine no?
nickrules
2010-08-06 22:42:24
From: Blumblebee
I don't understand why you need to withdraw stuff to high alch items. A simple ExistsItem(x) for the specified slot should work just fine no?
I think what RM is talking about, is, when the bot changes scripts - lets say from a steel plate smither to a high alcher, so, it has to withdraw what it is told to alch.
marpis
2010-08-07 02:21:42
Let's not talk about combined scripts at this point.
MSI_Alch(slotNumber: integer; HighAlch: boolean): boolean;
First we can make the alcher cast on everything that's in inventory, later add steel body records etc., it doesn't mean we have to use TItems now?
Coh3n
2010-08-07 09:35:52
From: marpis
Let's not talk about combined scripts at this point.
MSI_Alch(slotNumber: integer; HighAlch: boolean): boolean;
First we can make the alcher cast on everything that's in inventory, later add steel body records etc., it doesn't mean we have to use TItems now?
Basically everything we've written for the core has taken script switching into consideration. I agree with you, but we can't forget about it because we wouldn't want to have to rewrite everything when the time comes to add script switching support.
marpis
2010-08-07 11:17:54
From: Coh3n
Basically everything we've written for the core has taken script switching into consideration. I agree with you, but we can't forget about it because we wouldn't want to have to rewrite everything when the time comes to add script switching support.
Whatever we do with the alching doesn't affect adding multiscript support later :rolleyes: Basically we just need an Alch(itemslot: integer) and make a mainloop for an alcher script.
Now:- Drag any item in inventory to the best slot
- Cast Alch
- Repeat
Future:- Find the item we want to alch outside the Alch() function
- Drag the item in inventory to the best slot
- Cast Alch
- Do whatever spiderpig does
Coh3n
2010-08-07 12:16:24
From: marpis
Whatever we do with the alching doesn't affect adding multiscript support later :rolleyes: Basically we just need an Alch(itemslot: integer) and make a mainloop for an alcher script.
Now:
- Drag any item in inventory to the best slot
- Cast Alch
- Repeat
Future:
- Find the item we want to alch outside the Alch() function
- Drag the item in inventory to the best slot
- Cast Alch
- Do whatever spiderpig does
Yeah. It doesn't have to have the multiple script support. I just think it should be written so it can easily be added, which by the sounds of things is what you have in mind. :)
Sir R. M8gic1an
2010-08-07 15:53:00
Have Alch() drag the items to the optimal spot (16 for high alch ? ) as long as it is not a rune. It'll make alching more effective :)
~RM
marpis
2010-08-08 07:11:32
From: Rasta Magician
Have Alch() drag the items to the optimal spot (16 for high alch ? ) as long as it is not a rune. It'll make alching more effective :)
~RM
I don't think that should be put inside the Alch() function, for some reason… At least make it have a boolean parameter for that.
nickrules
2010-08-08 10:32:09
going away for a week, continue to post ideas/develop this (derp).
See ya soon :P
Coh3n
2010-08-08 11:06:02
From: marpis
I don't think that should be put inside the Alch() function, for some reason… At least make it have a boolean parameter for that.
We could even have a ManageInventory function that does more and that could be used for other skills.
nickrules
2010-08-17 23:23:41
Ah, I'm back.
Not a whole lot seems to have happened, but i dont know.
So, I take it, we need a way to move the item to a particular slot for a spell? Maybe, a function which is similar to the SpellToStr, but instead, it would be like SpellToSpot, or thereabouts? Thoughts please.
Also, it seems to me, that there aren't too many spells which require this kind of item movement and such.
Coh3n
2010-08-17 23:27:40
From: nickrules
Ah, I'm back.
Not a whole lot seems to have happened, but i dont know.
So, I take it, we need a way to move the item to a particular slot for a spell? Maybe, a function which is similar to the SpellToStr, but instead, it would be like SpellToSpot, or thereabouts? Thoughts please.
Also, it seems to me, that there aren't too many spells which require this kind of item movement and such.
Which ones other than high and low alch? And I think we should have a generic DragItem function that will drag any item to any slot.
function MSI_DragItem(Item, Slot: Integer): Boolean;
From: Coh3n
Which ones other than high and low alch? And I think we should have a generic DragItem function that will drag any item to any slot.
function MSI_DragItem(Item, Slot: Integer): Boolean;
I can most likely do that tomorrow after work if no one else has yet. It sounds fun :)
nickrules
2010-08-19 12:17:55
Ok, Im going to begin work on the item moving… gizmo, lol.
NCDS, or whoever makes the function for moving, make sure it is called/uses these constants:
MSI_DragItem(Item, Slot: Integer): boolean
Because thats what my function will use.
I'll edit this when im done
EDITZORZ: :D I have a MSI dev. cup & usefull poster cup! yay:)!
Coh3n
2010-08-19 13:56:41
From: nickrules
EDITZORZ: :D I have a MSI dev. cup & usefull poster cup! yay:)!
Congrats! :)
nickrules
2010-08-19 22:53:25
Bump, because I finished my part.
{*****************************************************************************}
{ function MSI_ItemSpellMover(what:integer): boolean; }
{ By: Nickrules }
{ Date: 5 August 2010 }
{ Description: Moves the item to the most ideal slot }
{*****************************************************************************}
Function MSI_ItemSpellMover(what, spell: integer): boolean;
Begin
case spell of
SPELL_ALCH_LOW: result := MSI_DragItem(What, 6);
SPELL_ALCH_HIGH: result := MSI_DragItem(What, 15);
SPELL_SUPERHEAT: result := MSI_DragItem(What, 13);
SPELL_ENCHANT_LVL1: result := MSI_DragItem(What, 3);
SPELL_ENCHANT_LVL2: result := MSI_DragItem(What, 7);
SPELL_ENCHANT_LVL3: result := MSI_DragItem(What, 15);
SPELL_ENCHANT_LVL4: result := MSI_DragItem(What, 17);
SPELL_ENCHANT_LVL5: result := MSI_DragItem(What, 23);
SPELL_ENCHANT_LVL6: result := MSI_DragItem(What, 18);
Else
begin
result := true;
end;
end;
end;
Procedure MSI_Loop_Cast(spell,which, waitTime, waitRand, totalCasts: Integer; IsObject: boolean);
var
CastSoFar, fails: intger;
anotherVar: boolean;
TheSpell: string;
begin
TheSpell := SpellToStr(spell)
MSI_ItemSpellMover(which,spell);
if (totalcasts = 0) then
begin
totalcasts := 9999999999;
end;
while castssofar to totalcasts do
begin
If not MSI_Cast(TheSpell, which,IsObject) then
begin
inc(fails);
MSI_DEBUG('MSI_Loop_Cast','something failed. Fails so far: '+inttostr(fails), 3);
MSI_DEBUG('MSI_Loop_Cast','trying 5 more times.', 3);
repeat
AnotherVar := MSI_Cast(TheSpell, which,IsObject);
Wait(waittime+random(waitrand));
if anotherVar then
begin
Writeln('MSI_Cast Returned true. Breaking failsafe loop');
Writeln('We got it on try number '+inttostr(failsafe)+' out of 5');
MSI_DEBUG('MSI_Loop_Cast','unce unce ucne - meltdown averted', 10);
failsafe := 0
break;
end;
If not AnotherVar then
begin
inc(failsafe);
writeln('Returned false on try number '+inttostr(failsafe)+'out of 5');
if (failsafe >= 5) then
begin
MSI_DEBUG('MSI_Loop_Cast','Casting failed 5 times. Terminating script', 10);
TerminateScript;
end;
end;
until((failsafe >= 5) or anotherVar = true);
end else
begin
Wait(waittime+random(waitrand));
inc(CastSoFar);
end;
end;
MSI_DEBUG('MSI_Loop_Cast', inttostr(CastsSoFar)+' casts, with '+IntToStr(fails)+' failed casts.', 7)
end;
Updated the first post with the full include.
From: nickrules
Bump, because I finished my part.
{*****************************************************************************}
{ function MSI_ItemSpellMover(what:integer): boolean; }
{ By: Nickrules }
{ Date: 5 August 2010 }
{ Description: Moves the item to the most ideal slot }
{*****************************************************************************}
Function MSI_ItemSpellMover(what, spell: integer): boolean;
Begin
case spell of
SPELL_ALCH_LOW: result := MSI_DragItem(What, 6);
SPELL_ALCH_HIGH: result := MSI_DragItem(What, 15);
SPELL_SUPERHEAT: result := MSI_DragItem(What, 13);
SPELL_ENCHANT_LVL1: result := MSI_DragItem(What, 3);
SPELL_ENCHANT_LVL2: result := MSI_DragItem(What, 7);
SPELL_ENCHANT_LVL3: result := MSI_DragItem(What, 15);
SPELL_ENCHANT_LVL4: result := MSI_DragItem(What, 17);
SPELL_ENCHANT_LVL5: result := MSI_DragItem(What, 23);
SPELL_ENCHANT_LVL6: result := MSI_DragItem(What, 18);
Else
begin
result := true;
end;
end;
end;
Procedure MSI_Loop_Cast(spell,which, waitTime, waitRand, totalCasts: Integer; IsObject: boolean);
var
CastSoFar, fails: intger;
anotherVar: boolean;
TheSpell: string;
begin
TheSpell := SpellToStr(spell)
MSI_ItemSpellMover(which,spell);
if (totalcasts = 0) then
begin
totalcasts := 9999999999;
end;
while castssofar to totalcasts do
begin
If not MSI_Cast(TheSpell, which,IsObject) then
begin
inc(fails);
MSI_DEBUG('MSI_Loop_Cast','something failed. Fails so far: '+inttostr(fails), 3);
MSI_DEBUG('MSI_Loop_Cast','trying 5 more times.', 3);
repeat
AnotherVar := MSI_Cast(TheSpell, which,IsObject);
Wait(waittime+random(waitrand));
if anotherVar then
begin
Writeln('MSI_Cast Returned true. Breaking failsafe loop');
Writeln('We got it on try number '+inttostr(failsafe)+' out of 5');
MSI_DEBUG('MSI_Loop_Cast','unce unce ucne - meltdown averted', 10);
failsafe := 0
break;
end;
If not AnotherVar then
begin
inc(failsafe);
writeln('Returned false on try number '+inttostr(failsafe)+'out of 5');
if (failsafe >= 5) then
begin
MSI_DEBUG('MSI_Loop_Cast','Casting failed 5 times. Terminating script', 10);
TerminateScript;
end;
end;
until((failsafe >= 5) or anotherVar = true);
end else
begin
Wait(waittime+random(waitrand));
inc(CastSoFar);
end;
end;
MSI_DEBUG('MSI_Loop_Cast', inttostr(CastsSoFar)+' casts, with '+IntToStr(fails)+' failed casts.', 7)
end;
Updated the first post with the full include.
My mistake. I thought you were doing the DragItem one for some reason. I should be able to get that in the morning hopefully. Either way it will be posted/Committed(hopefully) tomorrow.
Coh3n
2010-08-20 08:49:06
Does the Enchant spells need to be in that case? IIRC you can't enchant notes so if the user was going to enchant they would just click all the inventory slots with the jewelery in it.
Also, a cased function like that can be avoided if we made a TMSISpell type in Magic.simba to hold attributes like NeedsDrag: Boolean. I'm sure there would be other useful things that could go in the record.
nickrules
2010-08-20 18:42:54
I've no idea to be honest, I can't check, because I've canceled membership for several months.
It could also be click once, do all. like bones to bananas/peaches. except you dont need to click for bones to peaches. lol
i luffs yeww
2010-08-20 18:50:58
You can't enchant notes if that's what you're asking. You do one set of 12 I believe. Check runescape.wikia.com if you need to find things out. :p
Coh3n
2010-08-20 19:22:27
From: i luffs yeww
You can't enchant notes if that's what you're asking. You do one set of 12 I believe. Check runescape.wikia.com if you need to find things out. :p
Yeah so there's no point in dragging the items for the enchant spells. Otherwise you'll be enchanting, moving the item, enchanting, moving the items when you can just enchant in different inventory slots.
i luffs yeww
2010-08-20 19:32:34
Actually.. I'm pretty sure you don't do anything with the inventory at all.. You simply click on the pop up menu (shows on the main screen) and then it does a set of (I believe) 12.
Coh3n
2010-08-20 19:50:57
From: i luffs yeww
Actually.. I'm pretty sure you don't do anything with the inventory at all.. You simply click on the pop up menu (shows on the main screen) and then it does a set of (I believe) 12.
Oh wow, that's completely new. :o
Didn't know that at all. Is enchanting members only?
i luffs yeww
2010-08-20 21:05:16
I believe so. Dunno though. Haven't played RuneScape in months.
nickrules
2010-08-20 22:50:12
I think you're thinking of enchanting bolts luffs, I know that opens an interface.
Edit, if they had an interface, why would they have multiple spellbook icons?
i luffs yeww
2010-08-21 01:44:19
Yes, I am thinking of bolts. Enchant spells are generally used in MTA, but out of it (sapphire ring to ring of recoil, ruby ring to ring of forging, etc.), each item is needed to be clicked.
In case anyone doesn't know, after you click the enchant spell, it goes to the inventory tab, just like high/low alching. No dragging is necessary, tbh. Just if it finds it. (for i := 0 to Length(ITEMS_ENCHANTABLE) - 1 do if(FindDTM(ITEMS_ENCHANTABLE {or however you wanna do it}, x, y, MIX1, MIY1, MIX2, MIY2))then Mouse(x, y, 2, 2, True); (yay for not standardizing mid-sentence snippets! :3)).
Really isn't that difficult. :) Have fun.
I have an account with 93 mage if anyone wants to use it for testing/colors/items/whatever anyone needs to do. It's p2p.
Coh3n
2010-08-21 10:15:22
From: i luffs yeww
In case anyone doesn't know, after you click the enchant spell, it goes to the inventory tab, just like high/low alching. No dragging is necessary, tbh. Just if it finds it. (for i := 0 to Length(ITEMS_ENCHANTABLE) - 1 do if(FindDTM(ITEMS_ENCHANTABLE {or however you wanna do it}, x, y, MIX1, MIY1, MIX2, MIY2))then Mouse(x, y, 2, 2, True); (yay for not standardizing mid-sentence snippets! :3)).
Yes, that's what I was trying to say before. :p
nickrules
2010-08-21 10:20:33
Ah, ok. I don't think I will need the account but i'll keep it in mind, thanks :)
Also, I've updated the first post code a little bit.
Whats next? xD
Ah right, items.
ugh >_>
EDIT: It only calls the moving function once; at the very beginning of the function. Then it just searches like normal. more 'human', and speeds up the process.
Or maybe I haven't the slightest idea what you're talking about, lol.
So MSI_DragItem is useless now? or should still be saved for future reference?
Coh3n
2010-08-21 10:32:22
From: NCDS
So MSI_DragItem is useless now? or should still be saved for future reference?
No we still need it. If you have it, post it. I'm going through nick's code and make a few changes. Hope you don't mind, nick?
Fresh out of the oven:
function MSI_DragItem(Item, Slot: Integer): Boolean;
var
iSlots: TIntegerArray;
x, y: Integer;
begin
GameTab(tab_Inv);
iSlots := MSIFindItemSlots(Item);
if (Length(iSlots) < 1) then
Exit;
if (not iSlot[0] = Slot) then
DragItem(iSlot[0], Slot);
Wait(RandomRange(80, 120));
Result := FindDTM(MSI_Items[Item].DTM, x, y, InvBox(Slot).x1, InvBox(Slot).y1,
InvBox(Slot).x2, InvBox(Slot).y2);
end;
Coh3n
2010-08-21 11:50:33
I fixed up these functions and I also have a bunch of thoughts/ideas.
{******************************************************************************}
{ function MSI_ItemToSpellSlot(tem, spell: integer): boolean; }
{ By: Nickrules }
{ Date: 5 August 2010 }
{ Description: Moves the item to the most ideal slot }
{******************************************************************************}
function MSI_ItemToSpellSlot(item, spell: integer): boolean;
begin
case spell of
SPELL_ALCH_LOW:
result := MSI_DragItem(item, 6);
SPELL_ALCH_HIGH:
result := MSI_DragItem(item, 15);
SPELL_SUPERHEAT:
result := MSI_DragItem(item, 13);
else
MSI_SubDebug('MSI_ItemToSpellSlot: Invalid spell');
end;
end;
{******************************************************************************}
{ function MSI_CastItem(spell, item: integer): boolean; }
{ By: Nickrules }
{ Date: 28 June 2010 }
{ Description: Casts a given spell on a given object/item. }
{******************************************************************************}
function MSI_CastItem(spell, item: integer): boolean;
var
spellName: string;
begin
spellName := MSI_SpellToStr(spell);
if (not Cast(spellName, false)) then
begin
MSI_SubDebug('Failed to cast spell: ' + spellName);
exit;
end;
if (MSI_ClickItem(item, ['ast'])) then
begin
Result := True;
MSI_SubDebug('Cast ' + spellName + ' on ' + MSI_Items[item].Name);
end else
MSI_SubDebug('Failed to cast ' + spellName + ' on ' + MSI_Items[item].Name);
end;
{*****************************************************************************}
{ function MSI_CastObj(spellname: string; what: integer): boolean; }
{ By: Nickrules, shortened by Coh3n. Thanks. }
{ Date: 28 June 2010 }
{ Description: Casts a given spell on a given object/item. }
{*****************************************************************************}
function MSI_CastObject(spell, obj: integer): boolean;
var
spellName: string;
begin
spellName := MSI_SpellToStr(spell);
if (not Cast(spellName, false)) then
begin
MSI_SubDebug('Failed to cast spell: ' + spellName);
exit;
end;
if (MSI_FindObject(MSI_Objects[castOn], ClickLeft)) then
begin
Result := True;
MSI_SubDebug('Cast ' + spellName + ' on ' + MSI_Objects[obj].Name);
end else
MSI_SubDebug('Failed to cast ' + spellName + ' on ' + MSI_Objects[obj].Name);
end;
{*****************************************************************************}
{ function MSI_Cast(...): boolean; }
{ By: Nickrules }
{ Date: 28 June 2010 }
{ Description: Casts a given spell on a given object/item. }
{*****************************************************************************}
function MSI_Cast(spell, castOn: Integer; isObject: Boolean): Boolean;
begin
if (isObject) then
Result := MSI_CastObj(spellName, castOn)
else
Result := MSI_CastItem(spellName, castOn);
end;
I didn't get to your loop cast function, but it really needs some cleaning up/organizing. :o
- I would like to utilize the global variables in SRL's Magic.scar as much as we can. If some functions need updating, then I'm more happy to commit the necessary changes. This way we already have the required levels, exp and autocast attributes for each spell.
- We need a MSI_SetupMagic function that will setup the spell book properly depending on the spell being casted. It will also set the global variables in Magic.scar.
- We may need another function that will load the required runes and their amounts for each spell. This will have to be done in a 2D array.
- We need to figure out how the player's are going to be setup. Since there's only PlayerObjects, we need to figure out some way for the user to determine the spells they want to cast. This would be better with the form because we could make the components visible/invisible, but I was thinking we could add to the TPlayer record for the spells and the player only fills it out if they're doing magic. I'm not sure how I feel about that idea yet though.
- For alching, we could have it only alch notes, so we only have one record instead of one for every item people want to alch. This would, however, mean we couldn't withdraw the items from the bank.
- The latter point was to try to avoid having the user fill out which items to alch, but for enchanting we would need to withdraw from the bank, so that wouldn't really work. We would need to add another attribute for the users to setup if they were to do magic.
- There's probably a lot more that I haven't thought of…
i luffs yeww
2010-08-21 17:27:03
Well, Coh3n. This may not be the best way of thinking right now for MSI (I really haven't looked at anything MSI-related, tbh), but I'd suggest working on the main magic-related functions than things like enchanting jewelry. Alching, teleporting, and maybe a basic method for combat spells (changing the spell books around makes it VERY easy to have an extremely reliable method (orders them in a box shape, pretty much. Pretty nifty, imo).
Things like enchanting jewelry, crumbling undead, entangling, etc., aren't really necessary at all right now. I've never seen any script use any of those misc. spells (besides enchanting things in MTA, which wouldn't be hard to add at all).
But that's just a few suggestions. I really don't care. Just trying to help where I can. :)
nickrules
2010-08-21 19:49:10
From: Coh3n
——-
I didn't get to your loop cast function, but it really needs some cleaning up/organizing. :o
I agree, lol. Massive brainhurt trying to make/read that :redface:
From: Coh3n
[*]We need a MSI_SetupMagic function that will setup the spell book properly depending on the spell being casted. It will also set the global variables in Magic.scar.
Reset spellbook well… resets the spellbook, so that It works under the current configuration of srls magic include. unless its dynamic (works with different configurations). might as well just use that. no reason to mess with it….
From: Coh3n
[*]We may need another function that will load the required runes and their amounts for each spell. This will have to be done in a 2D array.
Would be useful, but im not sure how I would do this, lol.
From: Coh3n
[*]We need to figure out how the player's are going to be setup. Since there's only PlayerObjects, we need to figure out some way for the user to determine the spells they want to cast. This would be better with the form because we could make the components visible/invisible, but I was thinking we could add to the TPlayer record for the spells and the player only fills it out if they're doing magic. I'm not sure how I feel about that idea yet though.
Keep reading on…
From: Coh3n
[*]For alching, we could have it only alch notes, so we only have one record instead of one for every item people want to alch. This would, however, mean we couldn't withdraw the items from the bank.
I don't completly see how this would be useful. or why we wouldn't be able to withdraw….
Wait, what if we had a note part for TItems - the DTM could be generic, and then just have a few colors for the actual picture of the item (is that even needed?). or just assume they only have one noted item in the inventory. Epicthought methinks.
From: Coh3n
[*]The latter point was to try to avoid having the user fill out which items to alch, but for enchanting we would need to withdraw from the bank, so that wouldn't really work. We would need to add another attribute for the users to setup if they were to do magic.
No, adding another attribute isn't the answer. An item can be treated as an object, or the other way around, right? why not use that, and then, some items trigger some spells. Or a readln? crude, but effective, until the form is out. It looks to me like its fairly close to being done. Alternately, we could just continue to develop this until the form is out.
From: Coh3n
[*]There's probably a lot more that I haven't thought of…
Coh3n
2010-08-21 23:35:59
From: i luffs yeww
Well, Coh3n. This may not be the best way of thinking right now for MSI (I really haven't looked at anything MSI-related, tbh), but I'd suggest working on the main magic-related functions than things like enchanting jewelry. Alching, teleporting, and maybe a basic method for combat spells (changing the spell books around makes it VERY easy to have an extremely reliable method (orders them in a box shape, pretty much. Pretty nifty, imo).
Things like enchanting jewelry, crumbling undead, entangling, etc., aren't really necessary at all right now. I've never seen any script use any of those misc. spells (besides enchanting things in MTA, which wouldn't be hard to add at all).
But that's just a few suggestions. I really don't care. Just trying to help where I can. :)
I agree (at least for right now). I would like to have just F2P spells supported for the initial release of Magic.simba. Keep it simpler for now and we can gradually build up as time goes on.
From: nickrules
Reset spellbook well… resets the spellbook, so that It works under the current configuration of srls magic include. unless its dynamic (works with different configurations). might as well just use that. no reason to mess with it….
I just tested Cast(), and it's written so that no matter what the configuration is, it will work. So, if the combat spells were hidden and I wanted to cast wind strike, it would make the spells visible and cast it. :) That makes our life a lot easier.
From: nickrules
Would be useful, but im not sure how I would do this, lol.
Alright well I originally thought we could have an array with length equal to the number of spells, but I think it would work just fine if we kept resetting a global variable when necessary. This function could be combined with MSI_SpellToText (we would have to rename it of course).
const
RUNE_COUNT = 10; // Not sure exactly how many there are
RUNE_AIR = 0;
RUNE_WATER = 1;
//...
var
RequiredRunes: array[0..(RUNE_COUNT - 1)] of Integer;
procedure MSI_GetRequiredRunes(Spell: Integer);
begin
case Spell of
SPELL_WIND_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 5; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
end;
SPELL_WATER_STRIKE:
begin
RequiredRunes[RUNE_WATER] := 5;
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
end;
// Rest of the spells here
else
MSI_SubDebug('Invalid spell in MSI_GetRequiredRunes');
end;
end;
If you need more explanation on something, don't be afraid to ask. :)
From: nickrules
I don't completly see how this would be useful. or why we wouldn't be able to withdraw….
Currently in the player setup procedures, we have the script try to withdraw all the required tools if they're not found in the inventory (or in some cases, the equipment tab). We would also need it for enchanting since we would have to keep withdrawing the jewelery after each load.
From: nickrules
Wait, what if we had a note part for TItems - the DTM could be generic, and then just have a few colors for the actual picture of the item (is that even needed?). or just assume they only have one noted item in the inventory. Epicthought methinks.
I would like to have 1 DTM that works for ALL notes. With our MSI_FindItemSlots function, we can determine every slot which contains a note. Using that, we can move each note to the correct slot, then when finished, move on to the next slot with contains the note.
From: nickrules
No, adding another attribute isn't the answer. An item can be treated as an object, or the other way around, right? why not use that, and then, some items trigger some spells. Or a readln? crude, but effective, until the form is out. It looks to me like its fairly close to being done. Alternately, we could just continue to develop this until the form is out.
I was hoping to start testing this today, but there was a lot more to think about than I originally thought, plus I don't want to rush anything. I thought about putting the items in the Objects attribute, which could work. However, what about choosing spells? I want the player setup to be as simple as possible for the user, and if something like this was added to each player, I think it would still be simple and would just be more orgainzed in general (not to mention make much more sense). It would also make creating the form components easier.
with MSI_Players[1] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Active := True;
Member := False;
Location := ;
Scripts := [];
Objects := [[]]; // Would fill out normally if casting on an NPC
Loads[0] := ;
Loads[1] := ;
// Only fill out if you're using Magic!
Spells := [];
Items := [[]]; // For high/low alch, superheat, enchanting only
end;
That would require some painful array code (decent knowledge of 2D arrays), which I can take care of if need be. It would just be setup similar to Scripts is to Objects.
i luffs yeww
2010-08-22 00:01:26
AFAIK, Cast() only works correctly for f2p (after a certain spell, as p2p have different spells apparently). Did not read anything except "just tested Cast(), and it's written so that no matter what the configuration is, it will work. So, if the combat spells were hidden and I wanted to cast wind strike, it would make the spells visible and cast it."
Coh3n
2010-08-22 00:04:44
From: i luffs yeww
AFAIK, Cast() only works correctly for f2p (after a certain spell, as p2p have different spells apparently). Did not read anything except "just tested Cast(), and it's written so that no matter what the configuration is, it will work. So, if the combat spells were hidden and I wanted to cast wind strike, it would make the spells visible and cast it."
Well that's just something we'll have to test out.
i luffs yeww
2010-08-22 00:17:09
Unless something's been changed recently (in the last week or two) (which I don't think it has) (I can check the change log and hope) (or I can just test I suppose) (if you haven't noticed, I'm just having all of these parentheses because it's silly ^^), I think it's f2p only.
Coh3n
2010-08-22 00:19:50
From: i luffs yeww
Unless something's been changed recently (in the last week or two) (which I don't think it has) (I can check the change log and hope) (or I can just test I suppose) (if you haven't noticed, I'm just having all of these parentheses because it's silly ^^), I think it's f2p only.
Lol made me laugh. Well then… I think it would be best to keep MSI's mager F2P, until we get things up and running.
i luffs yeww
2010-08-22 00:25:16
Totally fine. I'd actually like to work on this some if I have the time. I'm sure it says somewhere in the thread what needs to be worked on, what's being worked on, etc., but I'm also sure that there's been work on it, so maybe some things I'd find are already done, meaning me working on them would be virtually useless.
tl;dr, what could I do to help.
Coh3n
2010-08-22 00:38:12
MSI_GetRequiredRunes & MSI_SpellToText need combining and narrowed down to only the F2P spells, and nick's MSI_Loop_Cast needs cleaning up, but I'm not sure if he's doing that or not. That's all I can think of off the top of my head.
Oh, we'll also need the procedure to setup the player:
- Get skill level, make sure it's high enough to cast the required spell
- Make sure we have the required runes. I think it'd be cool to also calculate how many spells we can cast depending on how many runes there are.
- We also need an idea for staffs.. like if we have a fire staff equipped, then we don't need fire runes.
From: Coh3n
- We also need an idea for staffs.. like if we have a fire staff equipped, then we don't need fire runes.
We can check for that easily enough. Perhaps have a 'UsingStaff' Boolean in DeclarePlayers, then do a check to get which type of staff they are using.
i luffs yeww
2010-08-22 00:43:31
^ Ew. D: whai? It's simple enough to check. I'd rather not have more set up things.
But it's your guys' stuff.
Coh3n
2010-08-22 00:44:26
From: NCDS
We can check for that easily enough. Perhaps have a 'UsingStaff' Boolean in DeclarePlayers, then do a check to get which type of staff they are using.
I'd rather not add another thing to DeclarePlayers. By the looks of it, we'll have to add something for Magic anyway. What if we just always looked for a staff while we're looking for the required runes. Like if the runes aren't found, we look for the staff or something.
From: i luffs yeww
^ Ew. D: whai? It's simple enough to check. I'd rather not have more set up things.
But it's your guys' stuff.
Yeah we could just check, getting late :/
If we just declare it with the other items then DTM check and a similarcolors check or FindColor or something.
Edit: @Coh3n, yeah that would be fine
Coh3n
2010-08-22 00:49:33
From: NCDS
Yeah we could just check, getting late :/
If we just declare it with the other items then DTM check and a similarcolors check or FindColor or something.
Edit: @Coh3n, yeah that would be fine
Yeah, could be incorporated into MSI_FindTool also. If it's found in the inventory, then we need to equip it.
E: Okay, I figured I'd make an "official" list of what I think needs to be done.
- MSI_SpellToText narrowed down to F2P only spells.
- MSI_RequiredRunes finished for F2P only spells.
var
RequiredRunes: array[0..(RUNE_COUNT - 1)] of Integer;
procedure MSI_GetRequiredRunes(Spell: Integer);
begin
case Spell of
SPELL_WIND_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 5; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
end;
SPELL_WATER_STRIKE:
begin
RequiredRunes[RUNE_WATER] := 5;
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
end;
// Rest of the spells here
else
MSI_SubDebug('Invalid spell in MSI_GetRequiredRunes');
end;
end;
MSI_SetupMagic- Get skill level, make sure it's high enough to cast the required spell
- Make sure we have the required runes. I think it'd be cool to also calculate how many spells we can cast depending on how many runes there are.
- We also need an idea for staffs.. like if we have a fire staff equipped, then we don't need fire runes.
Staff TItem colors. The DDTM points are on the first post.I don't think we need the required level or exp as those are stored in SRL's TSpell. We'll utilize this somehow.So yeah, lots to do. :)
Also, here's the updated MSI_Cast() function. We didn't need CastItem and CastObject as there was a lot of repeated code. This will work nicely. :)
{******************************************************************************}
{ function MSI_CastItem(spell, item: integer): boolean; }
{ By: Nickrules & Coh3n }
{ Date: 22 August 2010 }
{ Description: Casts 'spell' on item/object 'which' }
{******************************************************************************}
function MSI_Cast(spell, which: integer; isObject: boolean): boolean;
var
s, spellName: string;
spellInfo: TSpell;
didCast: boolean;
begin
spellName := MSI_SpellToText(spell);
spellInfo := GetSpellInfo(spellName);
if (not Cast(spellName, spellInfo.autoCast) then
begin
MSI_SubDebug('Failed to cast spell: ' + spellName);
exit;
end;
if (isObject) then
begin
didCast := MSI_FindObject(MSI_Objects[castOn], ClickLeft);
s := MSI_Objects[which].Name;
end else
begin
didCast := MSI_ClickItem(item, ['ast']);
s := MSI_Items[which].Name;
end;
if (didCast) then
begin
Result := True;
MSI_SubDebug('Cast ' + spellName + ' on ' + s);
end else
MSI_SubDebug('Failed to cast ' + spellName + ' on ' + s);
end;
i luffs yeww
2010-08-22 02:09:40
Thanks. I have time to work on this tonight so I might.
nickrules
2010-08-23 10:39:44
Official list has been put on the first post, some functions updated.
I'll do runes needed. someone else wanna do TItems for the runes/staff?
i luffs yeww
2010-08-23 14:00:58
Are we using BMPs/DTMs/blacklists/wat?
Coh3n
2010-08-23 14:02:53
DDTMs. See the "How to add an Item" section
here.
nickrules
2010-08-24 19:34:08
fuuuuuuuuuuuuuuuuuu
Was working on my laptop, walked away for a few mins, and it died. All that work >_> 6% battery capacity ftl.
EDIT: uuuuuuuughhhhhhhhhh I finally did it. That was really, really boring. lol
procedure MSI_GetRequiredRunes(Spell: Integer);
begin
case Spell of
SPELL_WIND_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
end;
SPELL_WATER_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_WATER] := 1;
end;
SPELL_EARTH_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_EARTH] := 2;
end;
SPELL_FIRE_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_FIRE] := 2;
end;
SPELL_WIND_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_CHAOS] := 1;
end;
SPELL_WATER_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_WATER] := 2;
end;
SPELL_EARTH_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_EARTH] := 3;
end;
SPELL_FIRE_BOLT:
begin
RequiredRunes[RUNE_AIR] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_FIRE] := 4;
end;
SPELL_WIND_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_DEATH] := 1;
end;
SPELL_WATER_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_WATER] := 3;
end;
SPELL_EARTH_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_EARTH] := 4;
end;
SPELL_FIRE_BLAST:
begin
RequiredRunes[RUNE_AIR] := 4; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_FIRE] := 5;
end;
SPELL_STATE_CONFUSE:
begin
RequiredRunes[RUNE_WATER] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_EARTH] := 2;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_WEAKE:
begin
RequiredRunes[RUNE_AIR] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 2;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_CURSE:
begin
RequiredRunes[RUNE_WATER] := 2; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_EARTH] := 3;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_BIND:
begin
RequiredRunes[RUNE_EARTH] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_WATER] := 3;
RequiredRunes[RUNE_NATURE] := 2;
end;
SPELL_TELE_HOME:
begin
RequiredRunes[RUNE_AIR] := 0; // All other runes would be set to 0 since they're not being used
end;
SPELL_TELE_VARROCK:
begin
RequiredRunes[RUNE_FIRE] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_TELE_LUMBY:
begin
RequiredRunes[RUNE_EARTH] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_TELE_FALLY:
begin
RequiredRunes[RUNE_WATER] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_ALCH_LOW:
begin
RequiredRunes[RUNE_FIRE] := 3; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_NATURE] := 1;
end;
SPELL_ALCH_HIGH:
begin
RequiredRunes[RUNE_FIRE] := 5; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_NATURE] := 1;
end;
SPELL_TELEGRAB:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_SUPERHEAT:
begin
RequiredRunes[RUNE_AIR] := 4; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_NATURE] := 1;
end;
else
MSI_SubDebug('Invalid spell in MSI_GetRequiredRunes');
end;
end;
Updated first post code and list
Coh3n
2010-08-25 00:39:35
Rep+, you're a trooper. :p
"You must spread some reputation…." :(
nickrules
2010-08-25 16:00:06
Who, me? Yeah, I rarely give rep as much as I should, lol. Usually don't remember to do that. But if I wanted to, I could rep pretty much everyone whos posted in the magic section for being super-awesome-cool and supportive :P
Unofficial thanks to everyone who's helped me :D thanks a bazillion million trillion x 1000 :P
Coh3n
2010-08-26 00:36:50
From: nickrules
Who, me? Yeah, I rarely give rep as much as I should, lol. Usually don't remember to do that. But if I wanted to, I could rep pretty much everyone whos posted in the magic section for being super-awesome-cool and supportive :P
Unofficial thanks to everyone who's helped me :D thanks a bazillion million trillion x 1000 :P
Sorry, I didn't mean you yourself needed to spread more. If you try to give rep to someone twice it says "You need to spread some reputation before giving to Username again". :p
nickrules
2010-09-01 18:21:58
//TItems
STAFF_AIR:
with MSI_Items[whichItem] do
begin
Name := 'Air staff';
UpText := ['of air'];
ItemP := Point(0, 0);
Colors := [12235442, 13353922, 12564407];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
STAFF_WATER:
with MSI_Items[whichItem] do
begin
Name := 'Water staff';
UpText := ['of water'];
ItemP := Point(0, 0);
Colors := [11804186, 14427424, 13115933];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
STAFF_EARTH:
with MSI_Items[whichItem] do
begin
Name := 'Earth staff';
UpText := ['of earth'];
ItemP := Point(0, 0);
Colors := [3227223, 4874115, 4808066];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
STAFF_FIRE:
with MSI_Items[whichItem] do
begin
Name := 'Fire staff';
UpText := ['of fire'];
ItemP := Point(0, 0);
Colors := [1713844, 1977293, 2109145];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
//MSI_GetItemColor
STAFF_AIR : Result := 12235442;
STAFF_WATER : Result := 13115933;
STAFF_EARTH : Result := 4610428;
STAFF_FIRE : Result := 1911496;
//DDTM Points
STAFF_AIR..STAFF_FIRE:
Result := [ Point(586, 219), Point(587, 216), Point(586, 223),
Point(566,242), Point(578,225)];
You know what to do ;)
Coh3n
2010-09-03 02:42:36
Awesome! Sorry I haven't given this that much attention, I've been extremely busy, but don't worry, I do plan to implement this as soon as I can. You've done an awesome job. :)
Coh3n
2010-09-03 15:58:39
Just orgainzed some of this code. I don't think we need ResetSpellBook as SRL's Cast does all that automatically if needed.
{==============================================================================\
| MSI Group Scripting Include |
| Magic.scar |
|==============================================================================|
| For all magic routines. |
\ _____________________________________________________________________________}
{$i SRL/SRL.scar}
{$i SRL/SRL/skill/Magic.scar}
var
RequiredRunes: array[0..(RUNE_COUNT - 1)] of Integer;
{******************************************************************************}
{ function SpellToString(Spell:integer): boolean; }
{ By: nickrules }
{ Date: 5 August 2010 }
{ Description: turns a spell into a useable string. }
{******************************************************************************}
Function SpellToStr(Spell: integer): string;
begin
case Spell of
SPELL_WIND_STRIKE : result := 'wind strike';
SPELL_WIND_BOLT : result := 'wind bolt';
SPELL_WIND_BLAST : result := 'wind blast';
SPELL_WIND_WAVE : result := 'wind wave';
SPELL_WATER_STRIKE : result := 'water strike';
SPELL_WATER_BOLT : result := 'water bolt';
SPELL_WATER_BLAST : result := 'water blast';
SPELL_WATER_WAVE : result := 'water wave';
SPELL_EARTH_STRIKE : result := 'earth strike';
SPELL_EARTH_BOLT : result := 'earth bolt';
SPELL_EARTH_BLAST : result := 'earth blast';
SPELL_EARTH_WAVE : result := 'earth wave';
SPELL_FIRE_STRIKE : result := 'fire strike';
SPELL_FIRE_BOLT : result := 'fire bolt';
SPELL_FIRE_BLAST : result := 'fire blast';
SPELL_FIRE_WAVE : result := 'fire wave';
SPELL_STATE_CONFUSE: result := 'confuse';
SPELL_STATE_WEAKE : result := 'weaken';
SPELL_STATE_CURSE : result := 'curse';
SPELL_STATE_BIND : result := 'bind';
SPELL_TELE_HOME : result := 'lumbridge home teleport';
SPELL_TELE_VARROCK : result := 'varrock teleport';
SPELL_TELE_LUMBY : result := 'lumbridge teleport';
SPELL_TELE_FALLY : result := 'falador teleport';
SPELL_ALCH_LOW : result := 'low level alchemy';
SPELL_ALCH_HIGH : result := 'high level alchemy';
SPELL_TELEGRAB : result := 'telekinetic grab';
SPELL_SUPERHEAT : result := 'superheat item';
else
MSI_SubDebug('Invalid spell. Check /msi/skill/magic.simba for a list.');
end;
end;
{******************************************************************************}
{ procedure MSI_GetRequiredRunes(Spell: Integer); }
{ By: nickrules & Coh3n }
{ Date: 5 August 2010 }
{ Description: Sets the RequiredRunes array depending on the user set spells }
{******************************************************************************}
procedure MSI_GetRequiredRunes(Spell: Integer);
begin
case Spell of
SPELL_WIND_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1; // All other runes would be set to 0 since they're not being used
RequiredRunes[RUNE_MIND] := 1;
end;
SPELL_WATER_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_WATER] := 1;
end;
SPELL_EARTH_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_EARTH] := 2;
end;
SPELL_FIRE_STRIKE:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_MIND] := 1;
RequiredRunes[RUNE_FIRE] := 2;
end;
SPELL_WIND_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2;
RequiredRunes[RUNE_CHAOS] := 1;
end;
SPELL_WATER_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2;
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_WATER] := 2;
end;
SPELL_EARTH_BOLT:
begin
RequiredRunes[RUNE_AIR] := 2;
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_EARTH] := 3;
end;
SPELL_FIRE_BOLT:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_CHAOS] := 1;
RequiredRunes[RUNE_FIRE] := 4;
end;
SPELL_WIND_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_DEATH] := 1;
end;
SPELL_WATER_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_WATER] := 3;
end;
SPELL_EARTH_BLAST:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_EARTH] := 4;
end;
SPELL_FIRE_BLAST:
begin
RequiredRunes[RUNE_AIR] := 4;
RequiredRunes[RUNE_DEATH] := 1;
RequiredRunes[RUNE_FIRE] := 5;
end;
SPELL_STATE_CONFUSE:
begin
RequiredRunes[RUNE_WATER] := 3;
RequiredRunes[RUNE_EARTH] := 2;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_WEAKE:
begin
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_MIND] := 2;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_CURSE:
begin
RequiredRunes[RUNE_WATER] := 2;
RequiredRunes[RUNE_EARTH] := 3;
RequiredRunes[RUNE_BODY] := 1;
end;
SPELL_STATE_BIND:
begin
RequiredRunes[RUNE_EARTH] := 3;
RequiredRunes[RUNE_WATER] := 3;
RequiredRunes[RUNE_NATURE] := 2;
end;
SPELL_TELE_HOME:
begin
end;
SPELL_TELE_VARROCK:
begin
RequiredRunes[RUNE_FIRE] := 1;
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_TELE_LUMBY:
begin
RequiredRunes[RUNE_EARTH] := 1;
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_TELE_FALLY:
begin
RequiredRunes[RUNE_WATER] := 1;
RequiredRunes[RUNE_AIR] := 3;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_ALCH_LOW:
begin
RequiredRunes[RUNE_FIRE] := 3;
RequiredRunes[RUNE_NATURE] := 1;
end;
SPELL_ALCH_HIGH:
begin
RequiredRunes[RUNE_FIRE] := 5;
RequiredRunes[RUNE_NATURE] := 1;
end;
SPELL_TELEGRAB:
begin
RequiredRunes[RUNE_AIR] := 1;
RequiredRunes[RUNE_LAW] := 1;
end;
SPELL_SUPERHEAT:
begin
RequiredRunes[RUNE_AIR] := 4;
RequiredRunes[RUNE_NATURE] := 1;
end;
else
MSI_SubDebug('Invalid spell in MSI_GetRequiredRunes');
end;
end;
{******************************************************************************}
{ function MSI_ItemToSpellSlot(tem, spell: integer): boolean; }
{ By: Nickrules }
{ Date: 5 August 2010 }
{ Description: Moves the item to the most ideal slot }
{******************************************************************************}
function MSI_ItemToSpellSlot(item, spell: integer): boolean;
begin
case spell of
SPELL_ALCH_LOW:
result := MSI_DragItem(item, 6);
SPELL_ALCH_HIGH:
result := MSI_DragItem(item, 15);
SPELL_SUPERHEAT:
result := MSI_DragItem(item, 13);
else
MSI_SubDebug('MSI_ItemToSpellSlot: Invalid spell');
end;
end;
{******************************************************************************}
{ function MSI_Cast(spell, which: integer; isObject: boolean): boolean; }
{ By: Nickrules & Coh3n }
{ Date: 22 August 2010 }
{ Description: Casts 'spell' on item/object 'which' }
{******************************************************************************}
function MSI_Cast(spell, which: integer; isObject: boolean): boolean;
var
s, spellName: string;
spellInfo: TSpell;
didCast: boolean;
begin
spellName := MSI_SpellToText(spell);
spellInfo := GetSpellInfo(spellName);
if (not Cast(spellName, spellInfo.autoCast) then
begin
MSI_SubDebug('Failed to cast spell: ' + spellName);
exit;
end;
if (isObject) then
begin
didCast := MSI_FindObject(MSI_Objects[which], ClickLeft);
s := MSI_Objects[which].Name;
end else
begin
didCast := MSI_ClickItem(which, ['ast']);
s := MSI_Items[which].Name;
end;
if (didCast) then
begin
Result := True;
MSI_SubDebug('Cast ' + spellName + ' on ' + s);
end else
MSI_SubDebug('Failed to cast ' + spellName + ' on ' + s);
end;
begin
SetupSRL;
ClearDebug;
end.
nickrules
2010-09-03 16:49:10
Gotcha.
Updated first post code & List.
Coh3n
2010-09-03 18:43:23
From: nickrules
Gotcha.
Updated first post code & List.
The two parts of MSI_SetupMagic you checked off aren't done. At least I didn't see where it was done?
nickrules
2010-09-04 09:07:13
Oh wow! Didn't catch that. Must have gotten getRequiredRunes and such mixed up. I also have an Idea for making the required runes account for a staff… I think.
If I just call another case after the first case, which checks for a staff, and then have said case set that staff's rune type to 0, would that do it? Or would that set everything to 0? Or another function completely….
Coh3n
2010-09-05 19:40:56
From: nickrules
Oh wow! Didn't catch that. Must have gotten getRequiredRunes and such mixed up. I also have an Idea for making the required runes account for a staff… I think.
If I just call another case after the first case, which checks for a staff, and then have said case set that staff's rune type to 0, would that do it? Or would that set everything to 0? Or another function completely….
Depending on how long the function would be, you should look for the staff at the very END of GetRequiredRunes and set the runes to 0 if the staff is found. That way if the runes were set in the first case, they can be reset to 0 at the end of the function.
procedure MSI_GetRequiredRunes();
begin
// The set rune case here
if (MSI_FindStaff(StaffType)) then
case StaffType of
STAFF_AIR:
RequiredRunes[RUNE_AIR] := 0;
// etc, etc.
end;
end;
nickrules
2010-09-18 08:03:25
Bump For Win! Heh heh heh, im so stupid :redface: :P
I'm back. Had some…. Stuff that needed to be taken care of.
Anyway, I got Staff support for the required runes done, and im working on a NumCanCast(Better name anyone?) function.
Going to update first post and this one when I finish that second part.
Alrighty, small problem:
Type
TRuneCount = Record
Air: Integer;
Water: Integer;
Earth: Integer;
Fire: Integer;
Death: Integer;
Cosmic: Integer;
Chaos: Integer;
Body: Integer;
Mind: Integer;
Nature: Integer;
Law: Integer;
end;
var
RequiredRunes: array[0..(RUNE_COUNT - 1)] of Integer;
{******************************************************************************}
{ function CalculateCasts: Integer; }
{ By: nickrules }
{ Date: 17 September 2010 }
{ Description: turns a spell into a useable string. }
{******************************************************************************}
Function CalculateCasts: Integer;
var RuneCount : TRuneCount;
TheThing: array[0..(RUNE_COUNT - 1)] of Integer;
begin
with RuneCount do
begin
Air := RuneAmount('inv','air');
Water := RuneAmount('inv','water');
Farth := RuneAmount('inv','earth');
Fire := RuneAmount('inv','Fire');
Mind := RuneAmount('inv','mind');
Body := RuneAmount('inv','body');
Chaos := RuneAmount('inv','chaos');
Death := RuneAmount('inv','death');
Cosmic := RuneAmount('inv','cosmic');
Nature := RuneAmount('inv','nature');
Law := RuneAmount('inv','law');
end;
Thething[0] := (runeCount.air / RequiredRunes[RUNE_AIR])
Thething[1] := (runeCount.Water / RequiredRunes[RUNE_WATER])
Thething[2] := (runeCount.Earth / RequiredRunes[RUNE_EARTH])
Thething[3] := (runeCount.Fire / RequiredRunes[RUNE_FIRE])
Thething[4] := (runeCount.Mind / RequiredRunes[RUNE_MIND])
Thething[5] := (runeCount.Body / RequiredRunes[RUNE_BODY])
Thething[6] := (runeCount.Chaos / RequiredRunes[RUNE_CHAOS])
Thething[7] := (runeCount.Death / RequiredRunes[RUNE_DEATH])
Thething[8] := (runeCount.Cosmic / RequiredRunes[RUNE_COSMIC])
Thething[9] := (runeCount.Nature / RequiredRunes[RUNE_NATURE])
Thething[10] := (RuneCount.Law / RequiredRunes[RUNE_LAW])
end;
Whats the problem? This will result in dived by 0 errors. Ideas?
Sir R. M8gic1an
2010-09-20 05:32:20
You are getting that error because some runes aren't needed, and so you are in fact dividing by 0.
I would suggest looping, as such:
var
RuneCount: array[RUNE_LOW..RUNE_HIGH] of integer;
for i:= RUNE_LOW to RUNE_HIGH do
if RequiredRunes[i] > 0 then
begin
TheThing[i] := round(RuneCount[i] / RequiredRunes[i]);
Result := min(Result, TheThing[i]);
end;
Btw, I think the magic section could use a few more threads, to keep everything organized :)
~RM
nickrules
2010-09-21 07:03:49
Alright, thanks. A lot more efficient too… why hadn't I thought of that? xD
From: nickrules
Alright, thanks. A lot more efficient too… why hadn't I thought of that? xD
If you would like to update this thread with updated Item records for the runes and staffs (assuming they got outdated), then I can help you out and do the MSI_SetupMagic.
I would really like to get Magic into MSI, even it starts with just some simple alching or SuperHeating.
Don't get me wrong, I'm not trying to take over this from you, just trying to help out to get this progressing a little faster. :)
Your work so far is greatly appreciated :)
Coh3n
2010-09-21 23:45:51
^ Yeah, it's getting really close to being finished. I think another thread may be necessary to discuss how to go about choosing spells and items (if needed).
nickrules
2010-09-23 22:28:29
NCDS, Go ahead. I'll make a new thread for it. assume all items are up to date, but i'll double check later….
nickrules
2010-09-23 22:32:23
Double post, don't hate, i'll merge it later. anyway, you should make that thread NCDS. probably more convenient, seeing as you'll be the main developer of setupmagic…
From: nickrules
Double post, don't hate, i'll merge it later. anyway, you should make that thread NCDS. probably more convenient, seeing as you'll be the main developer of setupmagic…
I will in the morning. not reallllly in the right state of mind at the monemt ;)
I'm thinking about doing something like this to SpellToStr:
function SpellsToStr(Spells: TIntegerArray): TStringArray;
begin
for i := Low(Spells) to High(Spells) do
begin
case Spell of
SPELL_WIND_STRIKE : result := 'wind strike';
SPELL_WIND_BOLT : result := 'wind bolt';
SPELL_WIND_BLAST : result := 'wind blast';
SPELL_WIND_WAVE : result := 'wind wave';
SPELL_WATER_STRIKE : result := 'water strike';
SPELL_WATER_BOLT : result := 'water bolt';
SPELL_WATER_BLAST : result := 'water blast';
SPELL_WATER_WAVE : result := 'water wave';
SPELL_EARTH_STRIKE : result := 'earth strike';
SPELL_EARTH_BOLT : result := 'earth bolt';
SPELL_EARTH_BLAST : result := 'earth blast';
SPELL_EARTH_WAVE : result := 'earth wave';
SPELL_FIRE_STRIKE : result := 'fire strike';
SPELL_FIRE_BOLT : result := 'fire bolt';
SPELL_FIRE_BLAST : result := 'fire blast';
SPELL_FIRE_WAVE : result := 'fire wave';
SPELL_STATE_CONFUSE: result := 'confuse';
SPELL_STATE_WEAKE : result := 'weaken';
SPELL_STATE_CURSE : result := 'curse';
SPELL_STATE_BIND : result := 'bind';
SPELL_TELE_HOME : result := 'lumbridge home teleport';
SPELL_TELE_VARROCK : result := 'varrock teleport';
SPELL_TELE_LUMBY : result := 'lumbridge teleport';
SPELL_TELE_FALLY : result := 'falador teleport';
SPELL_ALCH_LOW : result := 'low level alchemy';
SPELL_ALCH_HIGH : result := 'high level alchemy';
SPELL_TELEGRAB : result := 'telekinetic grab';
SPELL_SUPERHEAT : result := 'superheat item';
else
MSI_SubDebug('Invalid spell. Check /msi/skill/magic.simba for a list.');
end;
try
DeleteValueInIntArray(Spells, i);
except
end;
end;
end;
Just so that if we ever want to have a fighting script with magic support the user would be able to be set to cast more than one spell.
Is this worth it or shall we just keep it to load one?
lordsaturn
2010-09-27 18:02:43
From: NCDS
I'm thinking about doing something like this to SpellToStr:
function SpellsToStr(Spells: TIntegerArray): TStringArray;
begin
for i := Low(Spells) to High(Spells) do
begin
case Spell of
SPELL_WIND_STRIKE : result := 'wind strike';
SPELL_WIND_BOLT : result := 'wind bolt';
SPELL_WIND_BLAST : result := 'wind blast';
SPELL_WIND_WAVE : result := 'wind wave';
SPELL_WATER_STRIKE : result := 'water strike';
SPELL_WATER_BOLT : result := 'water bolt';
SPELL_WATER_BLAST : result := 'water blast';
SPELL_WATER_WAVE : result := 'water wave';
SPELL_EARTH_STRIKE : result := 'earth strike';
SPELL_EARTH_BOLT : result := 'earth bolt';
SPELL_EARTH_BLAST : result := 'earth blast';
SPELL_EARTH_WAVE : result := 'earth wave';
SPELL_FIRE_STRIKE : result := 'fire strike';
SPELL_FIRE_BOLT : result := 'fire bolt';
SPELL_FIRE_BLAST : result := 'fire blast';
SPELL_FIRE_WAVE : result := 'fire wave';
SPELL_STATE_CONFUSE: result := 'confuse';
SPELL_STATE_WEAKE : result := 'weaken';
SPELL_STATE_CURSE : result := 'curse';
SPELL_STATE_BIND : result := 'bind';
SPELL_TELE_HOME : result := 'lumbridge home teleport';
SPELL_TELE_VARROCK : result := 'varrock teleport';
SPELL_TELE_LUMBY : result := 'lumbridge teleport';
SPELL_TELE_FALLY : result := 'falador teleport';
SPELL_ALCH_LOW : result := 'low level alchemy';
SPELL_ALCH_HIGH : result := 'high level alchemy';
SPELL_TELEGRAB : result := 'telekinetic grab';
SPELL_SUPERHEAT : result := 'superheat item';
else
MSI_SubDebug('Invalid spell. Check /msi/skill/magic.simba for a list.');
end;
try
DeleteValueInIntArray(Spells, i);
except
end;
end;
end;
Just so that if we ever want to have a fighting script with magic support the user would be able to be set to cast more than one spell.
Is this worth it or shall we just keep it to load one?
I thought the whole point of the constants was so that you wouldn't have to use strings like 'wind strike'? Also with that function you will have a type mismatch because of the result.
nickrules
2010-09-27 19:00:48
The strings are used for SRLs cast function.
Also, I don't see whats wrong with that. Im not sure what would need to be changed, as I can't think right now. But I see little problem. Other than deciding what spell to cast.
From: lordsaturn
I thought the whole point of the constants was so that you wouldn't have to use strings like 'wind strike'? Also with that function you will have a type mismatch because of the result.
As nick said, the strings are used because we're trying to use as much of SRL's Magic.Simba as possible.
I'm also aware of the type mismatch. That's not a final product of the code, it was just to show what I was thinking of doing with it, and if it was thought to be necessary.
@nick, just so you know, the problem lordsaturn is pointing out is because right now it says :
result := 'wind strike';
but the function would be returning a TStringArray, so it would need to store all the selected spells (strings) to an array and set that as the result.
nickrules
2010-09-27 21:02:46
Honestly, I see little point in casting multiple spells. At this point, I think its best left where it is. First, we need to just get magic running. We can work on the fancy stuff later ;)
Coh3n
2010-09-28 14:01:19
From: nickrules
Honestly, I see little point in casting multiple spells. At this point, I think its best left where it is. First, we need to just get magic running. We can work on the fancy stuff later ;)
This, for now…
Keep SpellToStr as it is, and make a SpellToStrMulti if we need it.
From: Coh3n
This, for now…
Keep SpellToStr as it is, and make a SpellToStrMulti if we need it.
Gotcha, I've been a tad sidetracked with Randoms and fixes, but Magic.Simba is towards the top of my to-do list.
Coh3n
2010-10-16 19:43:19
I'm not sure if I've said this, but if someone is up for it, SRL's Magic.scar needs a little update before we can get moving with this. Check
this out for details. :)
Bonfield
2010-10-16 22:15:29
An option for multiple spells would be something stun alching, it makes around 110k exp an hour
Coh3n
2010-10-17 01:45:21
From: Bonfield
An option for multiple spells would be something stun alching, it makes around 110k exp an hour
There will be multiple spells. It depends on the script that's added.
Bonfield
2010-10-17 06:28:11
From: nickrules
Honestly, I see little point in casting multiple spells At this point, I think its best left where it is. First, we need to just get magic running. We can work on the fancy stuff later ;)
I was just putting forward an idea where casting multiple spells could be used, but thinking about it now I see no reason to use a tstringarray as it will depend on the mainloop/logic of the script, I really want to start creating some code for MSI but all I have atm is a iPhone and can't really compile any code
Nick, what are your thoughts about using SpellAvailable? In reply to your pm
nickrules
2010-10-20 17:01:30
I see no reason why It shouldn't work. Infact, its a great that you knew that that existed, otherwise i would never know about it. Thanks! Any ETA on when you will be getting a proper computer back?
Bonfield
2010-10-21 04:06:36
Umm laptop is fried, I think it might be the motherboard so no idea as when i can get back into this
Is this able to compile/test?
nickrules
2010-10-21 06:35:52
Once I commit some runes, it can theoretically be tested. Check out
http://villavu.com/forum/showthread.php?t=59527now i've
really gotta go. hahaha :p