Axe Software Forums
  Quest Developer Forum
  Is there...?


Author Topic:   Is there...?
Luridii posted 14-08-2001 09:36 GMT     
A way to tell quest that something is a string?

like for a procedure
do <#string#>
will look for a #string# procedure instead of whats inside the string.

Similarly and this would be useful in my battle system
set string <blah;##string1#weapon#>
Quest will read this as ''string1#weapon#

are there any brackets or similar you can use to say
set string <blah;#(#string1#)weapon#> to show which #'s go with which?

or do <(#string#)> to tell it to do the contents of the string procedure?

Computer Whizz posted 14-08-2001 10:15 GMT          
quote:

set string <blah;##string1#weapon#>

I would have thought you'd have:
set <blah;##string1##weapon##>
Let's put brackets in to understand it better:

set <blah;#(#string1#)(#weapon#)#>
so the string variable and weapon variable are both INSIDE a varible call thingy!

Think of it in this order:
1. The inside of the variable..... What do you want the INSIDE to be? Don't go putting #'s around the variable you want BEFORE you know what you want!
2. Now put the #'s around it and vwah-la!

As for the do <#string#>, why would you want to name a procedure #string#??
I've tried using this before and it wouldn't call the procedure that was inside the string...... I tried it in that fighting game I made, but it didn't work!

Computer Whizz

Luridii posted 14-08-2001 13:09 GMT          
I dont want the weapon 2 b a string but #string#weapon to be in 1.

Wiv wot u sed ##string1##weapon## quest will see it as ''string1''weapon''!

and wiv this
set
<blah;#(#string1#)(#weapon#)#>
quest will c it as #(# string1 #)(# weapon #)i've tried it :(

C what i mean wiv them, each # will go wiv the # nearest to it and in the asl log window u get a lot of variable not defined!

And I don't want 2 name a procedure #string#! I wanted it to run the procedure contained in #string, that wot i was sayin!

Alex posted 14-08-2001 20:12 GMT          
I think you're all bonkers. No programming language in the world offers the ability to run whatever procedure is named inside a string variable, and although Quest almost offers this kind of facility it would be immensely poor coding to do so. Why not just use an "if"? Surely you don't have an infinite number of procedures with all names under the sun, which would be the only case for needing the variable?
Computer Whizz posted 14-08-2001 22:08 GMT          
I'd stick to array's....

I know what you want, you want a different procedure for each weapon don't you!
Well, I'd give each weapon a number in the properties (WEAP_NO=1, ect...) and check it after it is used! Then go to the array #weapon[WEAP_NO]# and run that procedure.... but then again, there isn't much point if this do <#variable#> doesn't work..... I'm going to do a quick test in a minute and I'll get back to you guys!

Computer Whizz

MaDbRiT posted 15-08-2001 07:28 GMT          
Alex wrote:

quote:

I think you're all bonkers. No programming language in the world offers the ability to run whatever procedure is named inside a string variable, and although Quest almost offers this kind of facility it would be immensely poor coding to do so.

Hear hear Alex! I shudder to imagine how evil to debug code written in a language that allowed that kind of construct would be... I forecast many many crashes and bugs if it were allowed. :-(

Surely what you need is to write a weapon procedure and pass the string containing the name of the weapon (or a numeric variable representing the weapon - say 4 = the sword, 3 = the mace etc.) to it so that the battle system you're using can work out the way to treat the weapon's effectiveness with if/then/else clauses. That makes a lot more sense to me.

I'm baffled as to why you'd want to do it any other way, just thinking about it makes my head hurt!

Al

Luridii posted 15-08-2001 09:00 GMT          
The thing now works with a long if fomula and several strings, its just it would have been simpler to do a string inside a string...oh well


Computer Whizz posted 15-08-2001 14:33 GMT          
You would use it in random procedure's!
Say you had 300 procedure's that you want to go off randomly, then you'd want a "variable" to activate one of them!
You don't want to be around writing:
if (#var# = John) then do <john_proc> else {
if (#var# = Alex) then do <alex_proc> else {
if (#var# = Dave) then do <dave_proc> else {
ect...
You'd be there for hours on end. Then if there were any power cut's right after you did the final line, after not saving for a long period, you could loose the whole lot!!
This would take up TOO much time! A variable do <> command would be good.

Why would it be evil to debug? You'd have a locked variable so that it ALWAYS did a procedure! If anything went wrong, it would only be through a mis-spelling. And this would be easier to find then with over 300 line's of IF codes! Don't also forget that you have to have { and }'s on seperate lines; which means a file with over 600 line's in it just to get some variety which could be done in about 6!!

I think he wanted some different procedure for different types of weapon. eg. spike, club, bow and arrow. This way, you perform something like:
msg <You push the spike through the monster's heart and impale him!>
======seperate!====
msg <You hold the club above your head and bring it down on his noggin!>
======seperate!====
msg <You fire the arrow into the angels heart and watch her as she sinks to the ground in pain!>

Now I'm using these as examples, but you could use these to have different procedure's run, when something is different in the game.

Computer Whizz

Luridii posted 15-08-2001 17:06 GMT          
quote:
think he wanted some different procedure for different types of weapon.

Sorta, but what I wanted was more like your starting example


Alex posted 15-08-2001 18:49 GMT          
Well if you have 300 lines of "ifs", presumably you have 300 procedures. Which ain't gonna be pleasant to debug anyway. And why would you have 300 similar procedures in the first place?
Computer Whizz posted 15-08-2001 23:26 GMT          
You wouldn't have "similar" procedures, you'd have different procedure's!

It would be used to give the game a variety of storylines. EG. You're in a room with 30 people in, you go over to one and the game has one storyline, but if you entered the same room and went over to a different person first, they would all end up talking differently and so the storyline would change AGAIN!

Computer Whizz

passerby posted 16-08-2001 11:23 GMT          
Would it be possible to imitate executing procedures in string variables by using the 'execute a command as if it were typed by the player' QDK option?

This way you could store the commands in a string, and build the string up one word at a time, like luridii was trying to do, but instead of it being a procedure name, it would be 'look sword' or some such command name.

The only problem i can think of with this is that because the actions you want must be written as commands, it would be possible for players to accidentally trigger them by typing in the wrong command.

has anybody with more Quest experience than myself got any ideas on whether this is feasible?