 |
 |
 |
 |
|
 |
 |
|
 |
 |
| Author |
Message |
Damien
Joined: 15 Apr 2006 Posts: 65
|
Posted: Tue Jun 27, 2006 4:31 am Post subject: |
|
|
I just discovered something new :O
If i click Esc while selecting a target i get this error:
<appobj:ScriptExRef>
Damien is healing error errortext =
"Object does not support members" using
who would you like to heal?
Cancelled.
Soo look here:
| Code: |
program use_bandages(who, item)
var patient;
if (!item)
item := who[2];
patient := who[3];
who := who[1];
endif
SendSysMessage(who, who.name + " is healing " + patient.name + " using bandages" );
healing := GetAttribute(who, "healing");
Anatomy := GetAttribute(who, "anatomy");
EraseObjProperty(who, "IsMeditating");
if(!can_access(who, item))
return;
endif
var Sleeptime;
if (!patient)
SendSysMessage(who, "who would you like to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
endif
if(!patient)
SendSysMessage(who, "Cancelled.");
return;
endif
var poisons := ListPoisonsByType(patient, "defaultPoisons");
if(dist(who, patient) >= 2)
SendSysMessage(who, "Your patient is too far.");
return;
elseif(!CheckLineOfSight(who,patient))
SendSysMessage(who,"You can't see your patient.");
return;
elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0))
SendSysMessage(who,"Your patient is at full heath");
return;
endif
detach();
SetObjProperty(who, "HealTimer", clock);
|
I think this part is fucking with me:
| Code: |
if (!patient)
SendSysMessage(who, "who would you like to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
endif
if(!patient)
SendSysMessage(who, "Cancelled.");
return;
endif
var poisons := ListPoisonsByType(patient, "defaultPoisons");
if(dist(who, patient) >= 2)
SendSysMessage(who, "Your patient is too far.");
return;
elseif(!CheckLineOfSight(who,patient))
SendSysMessage(who,"You can't see your patient.");
return;
elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0))
SendSysMessage(who,"Your patient is at full heath");
return;
endif
detach();
SetObjProperty(who, "HealTimer", clock);
|
:] |
|
 |
|
|
 |
 |
| Author |
Message |
CWO
Joined: 04 Feb 2006 Posts: 691 Location: Chicago, IL USA
|
Posted: Tue Jun 27, 2006 9:34 am Post subject: |
|
|
Yes the error is that you dont target anyone.
The <appobj:ScriptExRef> is fine. That means your Start_script is running now without errors. With that working, you can change
var script := Start_Script(":healing:use_bandages", parms);
SendSysMessage(who, CStr(script));
to just
Start_Script(":healing:use_bandages", parms);
To fix the error Object doesnt support members, in the command script, put
| Code: | program healme(who)
SendSysMessage(who, "Who do you want to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
if (!patient)
SendSysMessage(who, "Cancelled");
return;
endif |
I also added to the Target command TGTOPT_HELPFUL + TGTOPT_CHECK_LOS because its true you should be able to check LOS and it should be flagged as something helpful so healing a grey and red are criminal actions... unless you dont want these, then you can adjust to the appropriate.
As for
| Code: | if (!patient)
SendSysMessage(who, "who would you like to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
endif
if(!patient)
SendSysMessage(who, "Cancelled.");
return;
endif
|
If this script isnt used for anything else but your command, you can remove
if (!patient)
SendSysMessage(who, "who would you like to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
endif
but if this is still used by double clicking bandages and stuff, leave it there. What that says is, if it doesnt have a patient (if you got here some other way then the command, you probably dont have it yet) then give you a target. If you still dont have a patient afterwards, cancel. If its only for the command, the corrections to the command script I suggested in this post will handle the targeting. |
|
 |
|
|
|