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
nijstar
Newbie


Joined: 05 Aug 2002
Posts: 9
Location: Australia

PostPosted: Mon Aug 05, 2002 3:26 pm   

#IF %case problems
 
%w steps into the attack, grabs your arm, and throws you violently


#wa 1800;
stand;
#IF (@co =~ "com1") 'co=coma';
#IF (@co =~ "com2") 'co=comb';
#IF (@co =~ "com3") 'co=comc';
#IF (@co =~ "com4") 'co=comd';
#IF (@co =~ "coma") %case(%random(4),co=com2,co=com3,co=com4);
#IF (@co =~ "comb") %case(%random(4),co=com1,co=com3,co=com4);
#IF (@co =~ "comc") %case(%random(4),co=com2,co=com1,co=com4);
#IF (@co =~ "comd") %case(%random(4),co=com2,co=com3,co=com1);

The if statements work by themeselves eg. #IF (@co =~ "com1") 'co=coma'; changes co from com1 to coma and #IF (@co =~ "comd") %case(%random(4),co=com2,co=com3,co=com1); changes co from comd to a random selection of com2, com3 or com1. However the I can not get the two blocks to work together. I know very little about programing this is not a text file script as I know nothing about using #file and #read it was entered using the create trigger tool in zmud. When I turn show trigger on it seems like it stops halfway through #IF (@co =~ "coma") %case(%random(4),co=com2,co=com3,co=com4); Could somebody please let me no why this doesn't work. Plus I would very much like to know the location of scripting in Zmud for complete beginers. A step by step of how to use the #file #read group of commands in creation of triggers would be great.
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Mon Aug 05, 2002 3:42 pm   
 
#IF (@co =~ "coma") {co=%case(%random(4),com2,com3,com4)}


"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Mon Aug 05, 2002 3:51 pm   
 
Alternatively,

#IF (@co =~ "coma") {#CASE %random(4) {co=com2} {co=com3} {co=com4}}

"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
nijstar
Newbie


Joined: 05 Aug 2002
Posts: 9
Location: Australia

PostPosted: Mon Aug 05, 2002 4:17 pm   
 
These ideas don't work.The first puts the coma, comb etc into the co variable the second returns a random number to the screen.
Reply with quote
nijstar
Newbie


Joined: 05 Aug 2002
Posts: 9
Location: Australia

PostPosted: Mon Aug 05, 2002 5:04 pm   
 
Im using 3.62 could this make a difference. Please take another look. Is there a limit to how many commands I can trigger? Please help this clueless Zombie.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Aug 05, 2002 6:46 pm   
 
If you're using version 3.62 you're pretty much on your own. Not because we aren't willing to help, but because many suggested solutions will include commands, functions, or capabilities which didn't exist in v3.62.

I really don't see any purpose to the first set of statements. Its also strange that you have %random(4) but only 3 choices in %case. Perhaps you could shorten your script to this:

%w steps into the attack, grabs your arm, and throws you violently

#wa 1800;
stand;
#IF (@co =~ "com1") %case(%random(1,3),co=com2,co=com3,co=com4);
#IF (@co =~ "com2") %case(%random(1,3),co=com1,co=com3,co=com4);
#IF (@co =~ "com3") %case(%random(1,3),co=com2,co=com1,co=com4);
#IF (@co =~ "com4") %case(%random(1,3),co=com2,co=com3,co=com1);

Personally, I've never used #READ or #FILE. They aren't necessary for most scripts in the current versions. As for where to find information on scripting, all I can do is suggest you look at the helpfiles (if any) provided with version 3.62.

LightBulb
Senior Member
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Tue Aug 06, 2002 1:11 am   
 
I'm confused as to what you want...

'These ideas don't work.The first puts the coma, comb etc into the co variable the second returns a random number to the screen.'

Which is what the co=com2 from
#IF (@co =~ "coma") %case(%random(4),co=com2,co=com3,co=com4);
in your original post will do....

I would definitely advise buying a newer version of zmud if you want to do scripting with support here - or at least check out the trial version for 30 days.


"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
nijstar
Newbie


Joined: 05 Aug 2002
Posts: 9
Location: Australia

PostPosted: Tue Aug 06, 2002 10:27 am   
 
Ok com1,2,3 and 4 are aliases for different attacks. There is another pattern which triggers the co variable causing one of the attacks to occur. The steps into the attack, grabs your arm pattern is a defensive manouver
which I have to avoid. What i was attempting with the If statements was to assign a random attack to co but not the same attack which was guarded against. The problem with the xcript the way that you have written it is that if it is com1 it has a good up to 3 chances of becoming com1 again and thereby hitting the guard again ie com1 becomes com2 com 2 becomes com1 or com1 becomes com3 com3 becomes com 1 or com1 becomes com4 com4 becomes com1. Hence the need for the earlier storage of the answer in coma or b or c and also the attempt at nesting the IF statements.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Aug 06, 2002 1:16 pm   
 
You problem, I believe, is that all of the variables are being expanded at once. What you would need to do is to move this part:
#IF (@co =~ "coma") %case(%random(4),co=com2,co=com3,co=com4);
#IF (@co =~ "comb") %case(%random(4),co=com1,co=com3,co=com4);
#IF (@co =~ "comc") %case(%random(4),co=com2,co=com1,co=com4);
#IF (@co =~ "comd") %case(%random(4),co=com2,co=com3,co=com1);

to a new alias, and then call that alias at the end of your trigger.

Kjata
Reply with quote
nijstar
Newbie


Joined: 05 Aug 2002
Posts: 9
Location: Australia

PostPosted: Tue Aug 06, 2002 1:27 pm   
 
Thankx everybody I upgraded to V6.16 and now the problem is solved. :)
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Aug 06, 2002 3:56 pm   
 
My concern is that the %case function is supposed to return a value, not execute any commands (including variable assignation). So I would do this:

#IF (@co = "coma") {#VAR co %case(%random(3),"com2","com3","com1")}
etc.

Troubadour
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