FAQ Search Memberlist Usergroups
Jolt Country Forum Index
Register Profile Log in to check your private messages Log in
Log in Log in

problem with a verb routine

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors
View previous topic :: View next topic  
Author Message
misterman83



Joined: 18 Feb 2016
Posts: 4
Location: Out There in Internet Land

PostPosted: Thu Apr 28, 2016 12:44 pm    Post subject: problem with a verb routine Reply with quote

I'm working on a tactical combat system, slightly based on Necrotic Drift. For some reason, my DoHit replacement isn't working: Either the verb messages aren't printing, or the verb routine isn't running when I type "attack x".
The verb routine calls an external routine to calculate attack and damage rolls, as well as deal damage.
The external routine calls yet another external routine to print combat messages.
I don't think the problem lies in the external routine: it works perfectly when enemies attack the player, but not for when the player attacks an enemy.
Any help is appreciated.
_________________
Official promoter of the
Hugo Interactive Fiction Language
a Better TADS than TADS;
a Better Inform than Inform
Back to top
View user's profile Send private message
misterman83



Joined: 18 Feb 2016
Posts: 4
Location: Out There in Internet Land

PostPosted: Thu Apr 28, 2016 12:47 pm    Post subject: Reply with quote

Whoops. I think I posted the topic twice.
_________________
Official promoter of the
Hugo Interactive Fiction Language
a Better TADS than TADS;
a Better Inform than Inform
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Fri Apr 29, 2016 7:51 am    Post subject: Reply with quote

I'd probably have to see the code to track it down. Does your external routine have an argument for the attacker, like:

AttackSystem(attacker, victim)

Then you'd have your replacement DoHit call it with:

AttackSystem(player, object)

(so then your code can check if the attacker is the player for player-optimised messages)
Back to top
View user's profile Send private message AIM Address
misterman83



Joined: 18 Feb 2016
Posts: 4
Location: Out There in Internet Land

PostPosted: Thu May 05, 2016 12:49 pm    Post subject: Reply with quote

Yes it does.
Here's my external attack routine:
routine fight(attacker, target)
{
AttackRoll = random(20)
if AttackRoll < target.armor_class: print CombatMessage(attacker, target, 1)
else {
print CombatMessage(attacker, target, 2)
DamageRoll = random(attacker.damage)
target.health -= (DamageRoll)
}
}

and Here's my combatMessages routine:
routine CombatMessage(attacker, target, num)
{
select num
case 1
{
print CThe(attacker);
print MatchPlural(attacker, "misses", "miss");
"!"
}
case 2
{
print CThe(attacker);
print MatchPlural(attacker, "hits", "hit");
print CThe(target);
" for ";
print number DamageRoll;
" damage!"
}
}
_________________
Official promoter of the
Hugo Interactive Fiction Language
a Better TADS than TADS;
a Better Inform than Inform
Back to top
View user's profile Send private message
Roody_Yogurt



Joined: 29 Apr 2002
Posts: 1993
Location: Milwaukee

PostPosted: Thu May 05, 2016 3:24 pm    Post subject: Reply with quote

First off, you want to be sure that your DoHit replacement is somewhere after roodylib is included (assuming you're using Roodylib), as that also replaces DoHit.

Then, you'd want your replacement to look something like this:

replace DoHit
{
if object is not living
VMessage(&DoHit)
elseif object = player
RlibMessage(&DoHit)
else
return fight(player, object)
}

Also, in your code, don't you want to set DamageRoll before you call the attack message?
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001 phpBB Group

Theme by Kage Musha - RPG Garden

Copyrights and trademarks are all of the belonging company. No copyright Infringement intended