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
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 3:06 am   

Problem with %numparam()
 
I made a short script for grabbing things from my container and placing it in my locker. But the %numparam() function is returning 0 every time.

Code:

#if (@weaponsIn = 0) {put @weapon in my @sheath}
open my @container
#wait
#echo %numparam( )
#LOOP %numparam( ) {
  get my %param( %i)
  put %param( %i) in locker
  #wait
  }
#noop
close my @container
#wait
#if (@weaponsIn = 0) {ready weapon}


The command I'm using to fire the alias is this: lockerput sculpture sword

And it open and closes my container, entirely skipping over the #loop. I inserted the #echo %numparam() and its returning 0.
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 3:10 am   
 
And just now it returned a -1 %numparam() with 2 parameters on the commandline.
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 3:45 am   
 
After some testing, it seems the problem may have something to do with the letters in the parameters.

I used the testParam alias from the documentation and played around with it. Here's what I'm getting from it:

testparam a rolling stone gathers no moss


> a
rolling





(notice the 4 blank lines where the rest of the parameters should have been)

testParam I'm only trying to put sculptures in my locker!

> I'm
only
trying






(again more blank lines)

testParam abc def ghi jkl mno pqrs tuv wxy z

> abc
def
ghi
jkl
mno
pqrs



(and again)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Feb 22, 2007 3:47 am   
 
Weird. I set up a similar situation, but it's worked for me. Noticed any other little problems like this? That's usually an indication that either your data files or ZMud itself has started to corrupt a bit.

If it's little niggling inconsistencies with command/function/feature behavior (ie, multi-state triggers all of a sudden stop working) all over the place, you might be able to get by with a simple reinstall (don't have to uninstall/unlicense/delete anything, just install right on top of your existing copy), otherwise you might want to check out the Migration Guide under ZMud Support.
_________________
EDIT: I didn't like my old signature
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 3:52 am   
 
After some consideration, it seems the problem might be other triggers triggering on those letters.

For example... the game is GemStone IV. I'm triggering off of many of the GSL codes, so my triggers go off individual letters for those. l, m, r, t, etc.

But it doesn't explain why the first problem with the original script is occurring. I'm not having those items echoed back to me, just trying to pick them up and put them in the locker.

I'll try reinstalling zMud and see if that helps, but in case it doesn't, any other suggestions?

(ps- I tend to get tons of Access Violation errors when modifying buttons and classes, especially if I pasted them from here.)
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 3:55 am   
 
Having the same problem after reinstall.
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 4:13 am   
 
Further testing reveals, yes it is the GSL triggers.

I went through these same things and removed all occurrences of the GSL triggers and it worked fine.

Is it possible to test for GSL codes without testing every occurrence of the individual letters?


Edit for even further testing.

Its not all of the GSL triggers, just the ones that do more than a few lines of work per trigger.

I have triggers set up on l, m, r, and P.

l and m both have only a single line to work on once triggered. but r and P have about 15 lines to work on.
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 4:45 am   
 
Hmm...

I rearranged the scripts a little and reduced r and P to 1 line each and the problem continues... I'm at a loss as to what else to try.
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Thu Feb 22, 2007 5:03 am   
 
Well, I found a crappy work around, but it works.

instead of using the %numparam() and a #loop, I set list = %1, then do #forall @list {blah blah blah}.

Downside is, its awkward to type vertical pipes between everything I want to do this with, but at least it functions. I'd still like to know if anyone comes up with a solution to what's going on with %numparam though.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Feb 22, 2007 10:52 pm   
 
#loop %numwords(%-1) {}

It's a better workaround than #FORALL, unless you are or planning to use multiword item keywords (which would require the use of quotes or brackets to separate).

EDIT: fixed typo, supposed to be %-1 instead of %1
_________________
EDIT: I didn't like my old signature

Last edited by MattLofton on Fri Feb 23, 2007 1:51 am; edited 1 time in total
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Fri Feb 23, 2007 12:20 am   
 
Wouldn't %1 return only 1 word though?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Feb 23, 2007 3:15 am   
 
%-1 will return the first parameter and all parameters following it (same for every %-n), so it's all parameters.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Caels
Beginner


Joined: 22 Feb 2007
Posts: 11

PostPosted: Sat Feb 24, 2007 1:24 am   
 
Now that's a nifty feature.

Thanks for all the input everyone! I'll try this out as opposed to the #forall and @list method I'm using right now
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