Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Kronus
Wanderer


Joined: 13 Jan 2002
Posts: 76
Location: USA

PostPosted: Wed Feb 06, 2002 5:10 am   

Scripting help!!
 
Ok first off this is my first script and so I am new to this. I opened up the built in text editor and wrote this(I am going to comment the code using //):

#var target //Creat variable for the victim.

@target = %prompt("","Enter the Target:") // Gets the target from the user

kill [@target] // Obviously tells the MUD to kill what the user inputed

#trigg {~ <Lifeforce ~[(&hp)~] Armor ~[(%d)~] Energy ~[(%d)~]~ >} {%if(@hp<35, flee, kill @target)} // Your status is show like this: < Lifeforce [##] Armor [##] Energy [##] >
// This is just to get the # of hit points and see if it is lower than 35, if
// If it is.. run.. if it isn't keep killing!!!

#trigg { * is DEAD!!} {%if ( @hp < 50, sleep, kill @target) } // This checks after the
// battle is over to see if you need to rest or not.

This is for Dragon Ball Universe. It's not working and if anyone can help me out or point me in the right direction I would be most grateful. Thanks!
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Feb 06, 2002 6:09 am   
 
#var target //Creat variable for the victim.
OK

@target = %prompt("","Enter the Target:")
OK

kill [@target]
OK

#trigger {~< Lifeforce ~[(&hp)~] Armor ~[(%d)~] Energy ~[(%d)~] ~>} {#if (@hp<35) {flee} {kill @target}}

#trigger { * is DEAD!!} {#if ( @hp < 50) {sleep} {kill @target}}


I more or less fixed:

1) Common mistake %if
> %function returns a value.
> #command does something
You are looking for the command version of
the #IF statements. You used the %prompt
function correctly as it will return a value
to the target variable. There is also
a command called #PROMPT which can be used
if you don't want to return a value.

2) ~ goes right in front of the
special characters.

3) When you specify &hp and it isn't mashed into
a word you do not need the {}.



TonDiening
Uses 6.16
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Fri Feb 08, 2002 5:09 am   
 

@target = %prompt("","Enter the Target:")
will return a logical value, i.e. if what you type is the same as the current contents of @target returns true

Try
target = %prompt("","Enter the Target:")

@variable expands the variable, to set it just use variable=value

BTW, you can do it all in one line
#VAR target %prompt("","Enter the Target:")
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Feb 08, 2002 5:44 am   
 
Ack my bad!

Indeed that is correct. I missed that.
Thanks Edwin for point that out!

TonDiening
Uses 6.16
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot 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

© 2009 Zugg Software. Hosted by Wolfpaw.net