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


Joined: 04 Nov 2004
Posts: 14

PostPosted: Sat Jan 20, 2007 6:28 pm   

Help With a trigger class
 
Ok, I've been trying to write this but I've very horrid with coding for this game. See, in this game you can build certain things off your ships and they go out to find things. What I wanted to do was make a class that I can enable, disable via button or just do it manually. The issue comes from the variable I would need to make and having it count. Here, I'll explain with using things from the game.


Helm reports heading at 1.1 degrees.
[Build Control]: Probe production started!
[Build Control]: Probe production completed!
[Sensors]: Probe is moving out.

When it would do the above, Helm reports, I wanted to have it automatically BUILD 9. Then when it says probe production complete, have it count by 0.1 up until of course 359.9, where it would then shut the class off automatically. Also, since in this game, to build things to build the probes, I wanted to see after each time to does helm reports, also have it auto type SUPPLY GO 4.

If any of the more skilled of coding could help me with this issue as I royally suck with it, I'd be much appreciated.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Jan 20, 2007 7:05 pm   
 
You'll need to explain a bit better exactly what you want the script to do, preferably as a numbered list. Your explanation was a bit confusing.

For now, know that %d in your trigger pattern probably won't match "1.1" since %d works the same as [0-9] - what you could do instead of %d is try [0-9.] or [0123456789.] for the wildcard.
_________________
Rorso's syntax colouriser.

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


Joined: 04 Nov 2004
Posts: 14

PostPosted: Sat Jan 20, 2007 7:39 pm   
 
Script:

(From the game)
Helm reports heading at 0.0 degrees.
(Script want it to do)
build 9
supply go 4
(From the game)
[Build Control]: Probe production completed!
(Script want it to do)
Add 0.1 to the degrees (Not sure how to set the variable, etc up) If it does not work, I will be satisified to work with 0.0 1.0 2.0 3.0, etc.
Rot (New number from the variable)


- - This would then basically reset the loop to keep going. When the script finally hits this.
Helm reports heading at 359.0 degrees.
Helm reports heading at 359.9 degrees. (Only if you can do it with adding 0.1)
I want the class to build 9 one last time, resupply and then disable the class. this then making it to where I can set the ship to a specific point and let it build these probes.
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Sun Jan 21, 2007 2:56 am   
 
Code:
#REGEX "build" {^Helm reports heading at (\d+\.\d+) degrees\.$} {#if (%1 <= 359.9) {
    build 9
    supply go 4
    } {#state build}}
#COND {^[Build Control]+: Probe production completed!$} {rot %eval( %t1 + 0.01)} {regex}

Here's a quick stab at it, completely untested so be sure to test it in a non-dangerous situation and let me know how it breaks.
Reply with quote
rpcervi
Beginner


Joined: 04 Nov 2004
Posts: 14

PostPosted: Sun Jan 21, 2007 7:44 am   
 
It worked for the first part of it, but I think it didn't capture the the order of the probe production being completed. It does however capture the game's ship rotating.

Thank you for trying, I'm going to see if I can expand on what you had and see if I can do it.

Also, for some reason, it stops directly afterwards it does one, I tried to manually rotate and it won't pick up on the rotation either. Not sure.
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Sun Jan 21, 2007 2:47 pm   
 
Ooops, silly me trusting the convert-to-regex function!

Code:
#REGEX "build" {^Helm reports heading at (\d+\.\d+) degrees\.$} {#if (%1 <= 359.9) {
    build 9
    supply go 4
    } {#state build}}
#COND {^\[Build Control\]: Probe production completed!$} {rot %eval( %t1 + 0.01)} {regex}


That should work, was an obvious error.
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